diff options
| author | Comment <tim@gray.(none)> | 2013-10-01 03:55:11 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-10-01 03:55:11 +0100 |
| commit | 01446a5627e0a4f8daf6d29e04d488b07d4b88de (patch) | |
| tree | 65e7d83b18b9eed01201f7a3ba017ab21b79ed45 /rotord/src | |
| parent | 41eb154001909c7ade5973e61a4cc4389fe36538 (diff) | |
very painful debugging
Diffstat (limited to 'rotord/src')
| -rw-r--r-- | rotord/src/libavwrapper.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/rotord/src/libavwrapper.cpp b/rotord/src/libavwrapper.cpp index b39428a..04e4366 100644 --- a/rotord/src/libavwrapper.cpp +++ b/rotord/src/libavwrapper.cpp @@ -136,7 +136,6 @@ bool libav::exporter::setup(int w,int h, int bitRate, int frameRate, std::string bool libav::exporter::record(std::string filename){ - printf("exporter 1 - using filename '%s'.\n",filename.c_str()); // allocate the output media context // avformat_alloc_output_context2(&oc, NULL, NULL, filename.c_str()); @@ -197,18 +196,15 @@ bool libav::exporter::record(std::string filename){ // Now that all the parameters are set, we can open the audio and // * video codecs and allocate the necessary encode buffers. // - printf("exporter 2.\n"); + if (video_st) open_video(oc, video_codec, video_st); - printf("exporter 3.\n"); if (audio_st) { - printf("exporter 4.\n"); audioframesize=open_audio(oc, audio_codec, audio_st); audiostep=((float)audioframesize)/(audio_st->codec->sample_rate); std::cerr << "opened audio codec with "<<audioframesize<<" frame size and "<<audiostep<<" seconds per frame"<<std::endl; } - printf("exporter 5.\n"); av_dump_format(oc, 0, filename.c_str(), 1); @@ -420,26 +416,34 @@ AVStream* libav::exporter::add_stream(AVFormatContext *oc, AVCodec **codec,enum void libav::exporter::open_video(AVFormatContext *oc, AVCodec *codec, AVStream *st) { + printf("open video 1.\n"); + int ret; AVCodecContext *c = st->codec; + printf("open video 2.\n"); + // open the codec // mutex.lock(); + printf("open video 3.\n"); ret = avcodec_open2(c, codec, NULL); //OPTIONS CAN GO HERE + printf("open video 4.\n"); mutex.unlock(); if (ret < 0) { //fprintf(stderr, "Could not open video codec: %s\n", av_err2str(ret)); exit(1); } - + printf("open video 5.\n"); // allocate and init a re-usable frame // frame = avcodec_alloc_frame(); + printf("open video 6.\n"); // moved to constructor and freeing in destructor -- stills crashes the same if (!frame) { //fprintf(stderr, "Could not allocate video frame\n"); exit(1); } + printf("open video 7.\n"); // Allocate the encoded raw picture. // ret = avpicture_alloc(&dst_picture, c->pix_fmt, c->width, c->height); if (ret < 0) { @@ -447,6 +451,7 @@ void libav::exporter::open_video(AVFormatContext *oc, AVCodec *codec, AVStream * exit(1); } + printf("open video 8.\n"); // If the output format is not YUV420P, then a temporary YUV420P // * picture is needed too. It is then converted to the required // * output format. // @@ -459,11 +464,13 @@ void libav::exporter::open_video(AVFormatContext *oc, AVCodec *codec, AVStream * } } - + printf("open video 9.\n"); // copy data and linesize picture pointers to frame // *((AVPicture *)frame) = dst_picture; + printf("open video 10.\n"); + outPixels = (uint8_t*)av_malloc(avpicture_get_size(PIX_FMT_YUV420P, st->codec->width,st->codec->height)); } |
