MCPcopy Create free account
hub / github.com/Motion-Project/motion / ffmpeg_put_frame

Function ffmpeg_put_frame

src/ffmpeg.c:1034–1069  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1032}
1033
1034static int ffmpeg_put_frame(struct ffmpeg *ffmpeg, const struct timeval *tv1)
1035{
1036 int retcd;
1037
1038 ffmpeg->pkt = my_packet_alloc(ffmpeg->pkt);
1039
1040 retcd = ffmpeg_set_pts(ffmpeg, tv1);
1041 if (retcd < 0) {
1042 //If there is an error, it has already been reported.
1043 ffmpeg_free_pkt(ffmpeg);
1044 return 0;
1045 }
1046
1047 retcd = ffmpeg_encode_video(ffmpeg);
1048 if (retcd != 0) {
1049 if (retcd != -2) {
1050 MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Error while encoding picture"));
1051 }
1052 ffmpeg_free_pkt(ffmpeg);
1053 return retcd;
1054 }
1055
1056 if (ffmpeg->tlapse == TIMELAPSE_APPEND) {
1057 retcd = ffmpeg_timelapse_append(ffmpeg, ffmpeg->pkt);
1058 } else {
1059 retcd = av_write_frame(ffmpeg->oc, ffmpeg->pkt);
1060 }
1061 ffmpeg_free_pkt(ffmpeg);
1062
1063 if (retcd < 0) {
1064 MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Error while writing video frame"));
1065 return -1;
1066 }
1067 return retcd;
1068
1069}
1070
1071static void ffmpeg_passthru_reset(struct ffmpeg *ffmpeg)
1072{

Callers 1

ffmpeg_put_imageFunction · 0.85

Calls 5

my_packet_allocFunction · 0.85
ffmpeg_set_ptsFunction · 0.85
ffmpeg_free_pktFunction · 0.85
ffmpeg_encode_videoFunction · 0.85
ffmpeg_timelapse_appendFunction · 0.85

Tested by

no test coverage detected