diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-06-07 16:14:33 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-06-07 16:14:33 +0100 |
| commit | a3801a0476f86b2a8ec69ef4060b1cdd605ec420 (patch) | |
| tree | 800d400f814ecd12caa6f83f8c36ca8c359daf77 /rotord/libavwrapper_guarded.h | |
| parent | 49ed3d2e3e4ed8385e8c007c334c01c65cd3acfe (diff) | |
fixed 2nd render only when delete context
Diffstat (limited to 'rotord/libavwrapper_guarded.h')
| -rwxr-xr-x | rotord/libavwrapper_guarded.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/rotord/libavwrapper_guarded.h b/rotord/libavwrapper_guarded.h index f38d407..646f23c 100755 --- a/rotord/libavwrapper_guarded.h +++ b/rotord/libavwrapper_guarded.h @@ -25,6 +25,10 @@ //*** Error in `./rotord': double free or corruption (out): 0x00007f3bf8210080 *** /////////////////////// + +//http://blog.tomaka17.com/2012/03/libavcodeclibavformat-tutorial/ +//great to use c++11 features + #ifndef UINT64_C #define UINT64_C(c) (c ## ULL) #endif @@ -86,6 +90,7 @@ namespace libav { decoder(PixelFormat pixelFormat=PIX_FMT_RGB24); //decoder(QUrl url, PixelFormat pixelFormat=PIX_FMT_RGB24); + void cleanup(); virtual ~decoder(); //bool open(QUrl url, enum PixelFormat formatParam = PIX_FMT_RGB24); //bool open(QIODevice& fileStream, QString& fileName, enum PixelFormat formatParam = PIX_FMT_RGB24); @@ -151,7 +156,7 @@ namespace libav { public: //typedef encoder::Channel Channel; - encoder(const char * file_name, int width, int height, float _framerate=25.0f, enum AVCodecID codec_id = CODEC_ID_MPEG4); + encoder(const char * file_name, int width, int height, float _framerate=25.0f, enum AVCodecID codec_id = CODEC_ID_H264); virtual ~encoder(); void setPixelIntensity(int x, int y, int c, uint8_t value); void write_frame(float seconds,uint8_t *rgbdata); @@ -168,6 +173,10 @@ namespace libav { float timebase; struct SwsContext *Sctx; + AVStream *audio_st; + AVStream *video_st; + + AVCodecContext *aCtx; int audio_input_frame_size; float audiostep; }; @@ -243,6 +252,7 @@ namespace libav { AVCodecContext* codecContext; AVFormatContext* formatContext; + int channels; //necessary to handle final packet -- unititialised after load/ problem? private: std::vector<uint16_t> buffer; AVFrame* frame; @@ -252,7 +262,7 @@ namespace libav { AVPacket packet; int sample_end; int sample_start; - int channels; //necessary to handle final packet + }; } |
