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

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

Add basic VTK structured points reader to nanovis, update copyright dates.

  • Property svn:eol-style set to native
File size: 2.5 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-2013  HUBzero Foundation, LLC
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
42{
43public:
44    enum VideoFormats {
45        MPEG1,
46        MPEG4,
47        THEORA,
48        QUICKTIME
49    };
50
51    AVTranslate(size_t width, size_t height);
52
53    AVTranslate(size_t width, size_t height, size_t bitRate, float frameRate);
54
55    virtual ~AVTranslate();
56
57    bool init(Outcome &status, const char *filename);
58
59    bool append(Outcome &status, uint8_t *rgbData, size_t linePad);
60
61    bool done(Outcome &status);
62
63private:
64    bool addVideoStream(Outcome &status, CodecID codecId, AVStream **stream);
65
66    bool allocPicture(Outcome &status, PixelFormat pixFmt, AVFrame **pic );
67
68    bool openVideo(Outcome &status);
69
70    bool writeVideoFrame(Outcome &status);
71
72    bool closeVideo(Outcome &status);
73
74    size_t width()
75    {
76        return _width;
77    }
78
79    void width(size_t width)
80    {
81        _width = width;
82    }
83
84    size_t height()
85    {
86        return _width;
87    }
88
89    void height(size_t width)
90    {
91        _width = width;
92    }
93
94    size_t bitRate()
95    {
96        return _bitRate;
97    }
98
99    void bitRate(size_t bitRate)
100    {
101        _bitRate = bitRate;
102    }
103
104    float frameRate()
105    {
106        return _frameRate;
107    }
108
109    void frameRate(size_t frameRate)
110    {
111        _frameRate = frameRate;
112    }
113
114    size_t _width;
115    size_t _height;
116    size_t _bitRate;
117    float _frameRate;         ///< frames/seconds
118    size_t _videoOutbufSize;
119    uint8_t *_videoOutbuf;
120
121    AVOutputFormat *_fmtPtr;
122    AVFormatContext *_ocPtr;
123    AVStream *_avStreamPtr;
124    AVFrame *_pictPtr, *_rgbPictPtr;
125
126};
127
128}
129 
130#endif
Note: See TracBrowser for help on using the repository browser.