summaryrefslogtreecommitdiff
path: root/rotord/libavexporter.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@herge.(none)>2013-04-19 19:43:30 +0100
committerTim Redfern <tim@herge.(none)>2013-04-19 19:43:30 +0100
commit3608a44b8222cfd76b8ba789e1f5ea6b7020a3e9 (patch)
tree9b05ce670e0ac5fb43fbd078c1af41d93fcbe28f /rotord/libavexporter.cpp
parent47b733bbc93e565d840596d4fbc2d5d5f3d18dd2 (diff)
libav output green/ not crashing
Diffstat (limited to 'rotord/libavexporter.cpp')
-rw-r--r--rotord/libavexporter.cpp11
1 files changed, 9 insertions, 2 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);