Commit 9e62ce68 authored by romansh's avatar romansh

   * 10000l (cut'n'paste is evil!)
   * Fix from Charles Yates for 0 sized packets


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@2341 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 315ea3b9
...@@ -540,12 +540,12 @@ static void do_video_out(AVFormatContext *s, ...@@ -540,12 +540,12 @@ static void do_video_out(AVFormatContext *s,
int size; int size;
/* create temporary picture */ /* create temporary picture */
size = avpicture_get_size(enc->pix_fmt, dec->width, dec->height); size = avpicture_get_size(target_pixfmt, dec->width, dec->height);
buf = av_malloc(size); buf = av_malloc(size);
if (!buf) if (!buf)
return; return;
formatted_picture = &picture_format_temp; formatted_picture = &picture_format_temp;
avpicture_fill(formatted_picture, buf, enc->pix_fmt, dec->width, dec->height); avpicture_fill(formatted_picture, buf, target_pixfmt, dec->width, dec->height);
if (img_convert(formatted_picture, target_pixfmt, if (img_convert(formatted_picture, target_pixfmt,
in_picture, dec->pix_fmt, in_picture, dec->pix_fmt,
...@@ -1256,7 +1256,7 @@ static int av_encode(AVFormatContext **output_files, ...@@ -1256,7 +1256,7 @@ static int av_encode(AVFormatContext **output_files,
len = pkt.size; len = pkt.size;
ptr = pkt.data; ptr = pkt.data;
while (len > 0) { do {
/* decode the packet if needed */ /* decode the packet if needed */
data_buf = NULL; /* fail safe */ data_buf = NULL; /* fail safe */
data_size = 0; data_size = 0;
...@@ -1314,7 +1314,7 @@ static int av_encode(AVFormatContext **output_files, ...@@ -1314,7 +1314,7 @@ static int av_encode(AVFormatContext **output_files,
av_free_packet(&pkt); av_free_packet(&pkt);
goto redo; goto redo;
} }
if (!got_picture) { if (len != 0 && !got_picture) {
/* no picture yet */ /* no picture yet */
ptr += ret; ptr += ret;
len -= ret; len -= ret;
...@@ -1431,7 +1431,7 @@ static int av_encode(AVFormatContext **output_files, ...@@ -1431,7 +1431,7 @@ static int av_encode(AVFormatContext **output_files,
} }
} }
av_free(buffer_to_free); av_free(buffer_to_free);
} } while (len > 0);
discard_packet: discard_packet:
av_free_packet(&pkt); av_free_packet(&pkt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment