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
RevLine 
[2798]1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
[1282]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
[1825]15#ifndef RP_AVTRANSLATE_H
16#define RP_AVTRANSLATE_H 1
[1282]17
[1309]18#include "nvconf.h"
[1282]19
[1815]20extern "C" {
[1899]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
[1309]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
[1815]36}
[1825]37#include "RpOutcome.h"
[1282]38
39namespace Rappture {
40
41class AVTranslate {
42public:
[1515]43    enum VideoFormats { MPEG1, MPEG4, THEORA, QUICKTIME };
[1325]44    AVTranslate(size_t width, size_t height);
[1282]45
[1351]46    AVTranslate(size_t width, size_t height, size_t bitRate, float frameRate);
[1282]47
48    virtual ~AVTranslate();
49
[1325]50    bool init(Outcome &status, const char *filename );
[1351]51    bool append(Outcome &status, uint8_t *rgbData, size_t linePad);
[1325]52    bool done(Outcome &status);
[1282]53
54private:
[1351]55    bool addVideoStream(Outcome &status, CodecID codecId, AVStream **stream);
[1571]56    bool allocPicture(Outcome &status, PixelFormat pixFmt, AVFrame **pic );
[1325]57    bool openVideo(Outcome &status);
58    bool writeVideoFrame(Outcome &status);
59    bool closeVideo(Outcome &status);
[1282]60
61    size_t _width;
62    size_t _height;
[1351]63    size_t _bitRate;
[1899]64    float _frameRate;           // frames/seconds
[1351]65    size_t _videoOutbufSize;
66    uint8_t *_videoOutbuf;
[1282]67
[1351]68    size_t width(void) {
[1899]69        return _width;
[1351]70    }
71    void width(size_t width) {
[1899]72        _width = width;
[1351]73    }
74    size_t height(void) {
[1899]75        return _width;
[1351]76    }
77    void height(size_t width) {
[1899]78        _width = width;
[1351]79    }
80    size_t bitRate(void) {
[1899]81        return _bitRate;
[1351]82    }
83    void bitRate(size_t bitRate) {
[1899]84        _bitRate = bitRate;
[1351]85    }
86    float frameRate(void) {
[1899]87        return _frameRate;
[1351]88    }
89    void frameRate(size_t frameRate) {
[1899]90        _frameRate = frameRate;
[1351]91    }
92    AVOutputFormat *_fmtPtr;
93    AVFormatContext *_ocPtr;
94    AVStream *_avStreamPtr;
95    AVFrame *_pictPtr, *_rgbPictPtr;
[1282]96
97};
98
99} // namespace Rappture
100 
[1825]101#endif /* RP_AVTRANSLATE_H */
Note: See TracBrowser for help on using the repository browser.