source: branches/blt4/packages/vizservers/nanovis/RpAVTranslate.h @ 1726

Last change on this file since 1726 was 1726, checked in by gah, 14 years ago
File size: 2.2 KB
Line 
1/*
2 * ======================================================================
3 *  Rappture::AVTranslate
4 *
5 *  AUTHOR:  Derrick Kearney, Purdue University
6 *
7 *  Copyright (c) 2004-2009  Purdue Research Foundation
8 * ----------------------------------------------------------------------
9 *  See the file "license.terms" for information on usage and
10 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 * ======================================================================
12 */
13
14#ifndef RAPPTURE_AVTRANSLATE_H
15#define RAPPTURE_AVTRANSLATE_H
16
17#include "nvconf.h"
18#include "RpOutcome.h"
19
20
21extern "C" {
22#ifdef HAVE_FFMPEG_AVFORMAT_H
23#include <ffmpeg/avformat.h>
24#endif
25#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
26#include <libavformat/avformat.h>
27#endif
28}
29
30namespace Rappture {
31
32class AVTranslate {
33public:
34    enum VideoFormats { MPEG1, MPEG4, THEORA, QUICKTIME };
35    AVTranslate(size_t width, size_t height);
36
37    AVTranslate(size_t width, size_t height, size_t bitRate, float frameRate);
38
39    virtual ~AVTranslate();
40
41    bool init(Outcome &status, const char *filename );
42    bool append(Outcome &status, uint8_t *rgbData, size_t linePad);
43    bool done(Outcome &status);
44
45private:
46    bool addVideoStream(Outcome &status, CodecID codecId, AVStream **stream);
47    bool allocPicture(Outcome &status, PixelFormat pixFmt, AVFrame **pic );
48    bool openVideo(Outcome &status);
49    bool writeVideoFrame(Outcome &status);
50    bool closeVideo(Outcome &status);
51
52    size_t _width;
53    size_t _height;
54    size_t _bitRate;
55    float _frameRate;           // frames/seconds
56    size_t _videoOutbufSize;
57    uint8_t *_videoOutbuf;
58
59    size_t width(void) {
60        return _width;
61    }
62    void width(size_t width) {
63        _width = width;
64    }
65    size_t height(void) {
66        return _width;
67    }
68    void height(size_t width) {
69        _width = width;
70    }
71    size_t bitRate(void) {
72        return _bitRate;
73    }
74    void bitRate(size_t bitRate) {
75        _bitRate = bitRate;
76    }
77    float frameRate(void) {
78        return _frameRate;
79    }
80    void frameRate(size_t frameRate) {
81        _frameRate = frameRate;
82    }
83    AVOutputFormat *_fmtPtr;
84    AVFormatContext *_ocPtr;
85    AVStream *_avStreamPtr;
86    AVFrame *_pictPtr, *_rgbPictPtr;
87
88};
89
90} // namespace Rappture
91 
92#endif // RAPPTURE_AVTRANSLATE_H
Note: See TracBrowser for help on using the repository browser.