source: trunk/packages/vizservers/nanovis/RpAVTranslate.h @ 1515

Last change on this file since 1515 was 1515, checked in by gah, 15 years ago
File size: 2.3 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#ifdef __cplusplus
21    extern "C" {
22#endif // ifdef __cplusplus
23
24#ifdef HAVE_FFMPEG_AVFORMAT_H
25#include <ffmpeg/avformat.h>
26#endif
27#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
28#include <libavformat/avformat.h>
29#endif
30
31namespace Rappture {
32
33class AVTranslate {
34public:
35    enum VideoFormats { MPEG1, MPEG4, THEORA, QUICKTIME };
36    AVTranslate(size_t width, size_t height);
37
38    AVTranslate(size_t width, size_t height, size_t bitRate, float frameRate);
39
40    virtual ~AVTranslate();
41
42    bool init(Outcome &status, const char *filename );
43    bool append(Outcome &status, uint8_t *rgbData, size_t linePad);
44    bool done(Outcome &status);
45
46private:
47    bool addVideoStream(Outcome &status, CodecID codecId, AVStream **stream);
48    bool allocPicture(Outcome &status, int pixFmt, AVFrame **pic );
49    bool openVideo(Outcome &status);
50    bool writeVideoFrame(Outcome &status);
51    bool closeVideo(Outcome &status);
52
53    size_t _width;
54    size_t _height;
55    size_t _bitRate;
56    float _frameRate;           // frames/seconds
57    size_t _videoOutbufSize;
58    uint8_t *_videoOutbuf;
59
60    size_t width(void) {
61        return _width;
62    }
63    void width(size_t width) {
64        _width = width;
65    }
66    size_t height(void) {
67        return _width;
68    }
69    void height(size_t width) {
70        _width = width;
71    }
72    size_t bitRate(void) {
73        return _bitRate;
74    }
75    void bitRate(size_t bitRate) {
76        _bitRate = bitRate;
77    }
78    float frameRate(void) {
79        return _frameRate;
80    }
81    void frameRate(size_t frameRate) {
82        _frameRate = frameRate;
83    }
84    AVOutputFormat *_fmtPtr;
85    AVFormatContext *_ocPtr;
86    AVStream *_avStreamPtr;
87    AVFrame *_pictPtr, *_rgbPictPtr;
88
89};
90
91} // namespace Rappture
92 
93#ifdef __cplusplus
94    }
95#endif // ifdef __cplusplus
96
97#endif // RAPPTURE_AVTRANSLATE_H
Note: See TracBrowser for help on using the repository browser.