diff options
Diffstat (limited to 'rotord')
| -rw-r--r-- | rotord/libavexporter.cpp | 11 | ||||
| -rw-r--r-- | rotord/libavexporter.h | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/rotord/libavexporter.cpp b/rotord/libavexporter.cpp index a46de5a..72ca180 100644 --- a/rotord/libavexporter.cpp +++ b/rotord/libavexporter.cpp @@ -73,7 +73,11 @@ bool libav::exporter::record(std::string filename){ return false; } - frame=0; + if (frame) + frame->pts = 0; + + outputframe=0; + return true; } bool libav::exporter::encodeFrame(unsigned char *pixels){ @@ -98,17 +102,20 @@ bool libav::exporter::encodeFrame(unsigned char *pixels){ write_audio_frame(oc, audio_st, samples); } else { write_video_frame(oc, video_st, pixels); + frame->pts += av_rescale_q(1, video_st->codec->time_base, video_st->time_base); } av_free(samples); - std::cerr << "encoded frame " << outputframe << std::endl; + //std::cerr << "encoded frame " << outputframe << std::endl; outputframe++; return true; } void libav::exporter::finishRecord(){ + + av_write_trailer(oc); // Close each codec. // if (video_st) close_video(oc, video_st); diff --git a/rotord/libavexporter.h b/rotord/libavexporter.h index 27bbbe5..c9984cb 100644 --- a/rotord/libavexporter.h +++ b/rotord/libavexporter.h @@ -229,7 +229,7 @@ namespace libav { { avcodec_close(st->codec); - + } //************************************************************// @@ -270,7 +270,7 @@ namespace libav { // * picture is needed too. It is then converted to the required // * output format. // if (c->pix_fmt != AV_PIX_FMT_YUV420P) { - ret = avpicture_alloc(&src_picture, AV_PIX_FMT_YUV420P, c->width, c->height); + ret = avpicture_alloc(&src_picture, AV_PIX_FMT_RGB24, c->width, c->height); if (ret < 0) { //fprintf(stderr, "Could not allocate temporary picture: %s\n", // av_err2str(ret)); @@ -396,7 +396,7 @@ namespace libav { av_free(src_picture.data[0]); av_free(dst_picture.data[0]); av_free(frame); - av_free(outPixels); + //av_free(outPixels); SIGSEV here } class exporter { |
