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

Last change on this file since 2277 was 2096, checked in by ldelgass, 13 years ago

Normalize line endings, set eol-style to native on *.cpp, *.h files

  • Property svn:eol-style set to native
File size: 2.4 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 RP_AVTRANSLATE_H
15#define RP_AVTRANSLATE_H 1
16
17#include "nvconf.h"
18
19extern "C" {
20#ifndef INT64_C
21#if SIZEOF_LONG == 8
22#  define INT64_C(c)  c ## L
23#  define UINT64_C(c) c ## UL
24#else
25#  define INT64_C(c)  c ## LL
26#  define UINT64_C(c) c ## ULL
27# endif
28#endif
29#ifdef HAVE_FFMPEG_AVFORMAT_H
30#include <ffmpeg/avformat.h>
31#endif
32#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
33#include <libavformat/avformat.h>
34#endif
35}
36#include "RpOutcome.h"
37
38namespace Rappture {
39
40class AVTranslate {
41public:
42    enum VideoFormats { MPEG1, MPEG4, THEORA, QUICKTIME };
43    AVTranslate(size_t width, size_t height);
44
45    AVTranslate(size_t width, size_t height, size_t bitRate, float frameRate);
46
47    virtual ~AVTranslate();
48
49    bool init(Outcome &status, const char *filename );
50    bool append(Outcome &status, uint8_t *rgbData, size_t linePad);
51    bool done(Outcome &status);
52
53private:
54    bool addVideoStream(Outcome &status, CodecID codecId, AVStream **stream);
55    bool allocPicture(Outcome &status, PixelFormat pixFmt, AVFrame **pic );
56    bool openVideo(Outcome &status);
57    bool writeVideoFrame(Outcome &status);
58    bool closeVideo(Outcome &status);
59
60    size_t _width;
61    size_t _height;
62    size_t _bitRate;
63    float _frameRate;           // frames/seconds
64    size_t _videoOutbufSize;
65    uint8_t *_videoOutbuf;
66
67    size_t width(void) {
68        return _width;
69    }
70    void width(size_t width) {
71        _width = width;
72    }
73    size_t height(void) {
74        return _width;
75    }
76    void height(size_t width) {
77        _width = width;
78    }
79    size_t bitRate(void) {
80        return _bitRate;
81    }
82    void bitRate(size_t bitRate) {
83        _bitRate = bitRate;
84    }
85    float frameRate(void) {
86        return _frameRate;
87    }
88    void frameRate(size_t frameRate) {
89        _frameRate = frameRate;
90    }
91    AVOutputFormat *_fmtPtr;
92    AVFormatContext *_ocPtr;
93    AVStream *_avStreamPtr;
94    AVFrame *_pictPtr, *_rgbPictPtr;
95
96};
97
98} // namespace Rappture
99 
100#endif /* RP_AVTRANSLATE_H */
Note: See TracBrowser for help on using the repository browser.