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

Last change on this file since 2852 was 2798, checked in by ldelgass, 12 years ago

Add emacs mode magic line in preparation for indentation cleanup

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