* commit '7751e4693dd10ec98c20fbd9887233b575034272': ogg: check that the expected number of headers had been parsed libx264: change default to closed gop to match x264cli Use avcodec_free_frame() to free AVFrames. lavf: use a malloced AVFrame in try_decode_frame(). lavc: add avcodec_free_frame(). lavc: ensure extended_data is set properly on decoding lavc: initialize AVFrame.extended_data in avcodec_get_frame_defaults() lavc: use av_mallocz to allocate AVFrames. lavc: rename the argument of avcodec_alloc_frame/get_frame_defaults Conflicts: doc/APIchanges doc/examples/decoding_encoding.c libavcodec/utils.c libavcodec/version.h libavfilter/src_movie.c libavformat/oggdec.c libavformat/oggdec.h libavformat/oggparsetheora.c libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n1.0
@@ -83,6 +83,10 @@ API changes, most recent first: | |||||
2012-03-26 - a67d9cf - lavfi 2.66.100 | 2012-03-26 - a67d9cf - lavfi 2.66.100 | ||||
Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. | Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. | ||||
2012-09-23 - xxxxxxx - lavc 54.28.0 - avcodec.h | |||||
Add avcodec_free_frame(). This function must now | |||||
be used for freeing an AVFrame. | |||||
2012-09-12 - xxxxxxx - lavu 51.41.0 - audioconvert.h | 2012-09-12 - xxxxxxx - lavu 51.41.0 - audioconvert.h | ||||
Added AV_CH_LOW_FREQUENCY_2 channel mask value. | Added AV_CH_LOW_FREQUENCY_2 channel mask value. | ||||
@@ -222,7 +222,7 @@ static void audio_encode_example(const char *filename) | |||||
fclose(f); | fclose(f); | ||||
av_freep(&samples); | av_freep(&samples); | ||||
av_freep(&frame); | |||||
avcodec_free_frame(&frame); | |||||
avcodec_close(c); | avcodec_close(c); | ||||
av_free(c); | av_free(c); | ||||
} | } | ||||
@@ -320,7 +320,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) | |||||
avcodec_close(c); | avcodec_close(c); | ||||
av_free(c); | av_free(c); | ||||
av_free(decoded_frame); | |||||
avcodec_free_frame(&decoded_frame); | |||||
} | } | ||||
/* | /* | ||||
@@ -454,7 +454,7 @@ static void video_encode_example(const char *filename, int codec_id) | |||||
avcodec_close(c); | avcodec_close(c); | ||||
av_free(c); | av_free(c); | ||||
av_freep(&frame->data[0]); | av_freep(&frame->data[0]); | ||||
av_free(frame); | |||||
avcodec_free_frame(&frame); | |||||
printf("\n"); | printf("\n"); | ||||
} | } | ||||
@@ -594,7 +594,7 @@ static void video_decode_example(const char *outfilename, const char *filename) | |||||
avcodec_close(c); | avcodec_close(c); | ||||
av_free(c); | av_free(c); | ||||
av_free(picture); | |||||
avcodec_free_frame(&picture); | |||||
printf("\n"); | printf("\n"); | ||||
} | } | ||||
@@ -163,6 +163,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st) | |||||
fprintf(stderr, "Error while writing audio frame\n"); | fprintf(stderr, "Error while writing audio frame\n"); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
avcodec_free_frame(&frame); | |||||
} | } | ||||
static void close_audio(AVFormatContext *oc, AVStream *st) | static void close_audio(AVFormatContext *oc, AVStream *st) | ||||
@@ -417,11 +417,11 @@ void av_noreturn exit_program(int ret) | |||||
bsfc = next; | bsfc = next; | ||||
} | } | ||||
output_streams[i]->bitstream_filters = NULL; | output_streams[i]->bitstream_filters = NULL; | ||||
avcodec_free_frame(&output_streams[i]->filtered_frame); | |||||
av_freep(&output_streams[i]->forced_keyframes); | av_freep(&output_streams[i]->forced_keyframes); | ||||
av_freep(&output_streams[i]->avfilter); | av_freep(&output_streams[i]->avfilter); | ||||
av_freep(&output_streams[i]->logfile_prefix); | av_freep(&output_streams[i]->logfile_prefix); | ||||
av_freep(&output_streams[i]->filtered_frame); | |||||
av_freep(&output_streams[i]); | av_freep(&output_streams[i]); | ||||
} | } | ||||
for (i = 0; i < nb_input_files; i++) { | for (i = 0; i < nb_input_files; i++) { | ||||
@@ -429,7 +429,7 @@ void av_noreturn exit_program(int ret) | |||||
av_freep(&input_files[i]); | av_freep(&input_files[i]); | ||||
} | } | ||||
for (i = 0; i < nb_input_streams; i++) { | for (i = 0; i < nb_input_streams; i++) { | ||||
av_freep(&input_streams[i]->decoded_frame); | |||||
avcodec_free_frame(&input_streams[i]->decoded_frame); | |||||
av_dict_free(&input_streams[i]->opts); | av_dict_free(&input_streams[i]->opts); | ||||
free_buffer_pool(&input_streams[i]->buffer_pool); | free_buffer_pool(&input_streams[i]->buffer_pool); | ||||
avfilter_unref_bufferp(&input_streams[i]->sub2video.ref); | avfilter_unref_bufferp(&input_streams[i]->sub2video.ref); | ||||
@@ -1795,7 +1795,7 @@ static int video_thread(void *arg) | |||||
avfilter_graph_free(&graph); | avfilter_graph_free(&graph); | ||||
#endif | #endif | ||||
av_free_packet(&pkt); | av_free_packet(&pkt); | ||||
av_free(frame); | |||||
avcodec_free_frame(&frame); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -2296,7 +2296,7 @@ static void stream_component_close(VideoState *is, int stream_index) | |||||
swr_free(&is->swr_ctx); | swr_free(&is->swr_ctx); | ||||
av_freep(&is->audio_buf1); | av_freep(&is->audio_buf1); | ||||
is->audio_buf = NULL; | is->audio_buf = NULL; | ||||
av_freep(&is->frame); | |||||
avcodec_free_frame(&is->frame); | |||||
if (is->rdft) { | if (is->rdft) { | ||||
av_rdft_end(is->rdft); | av_rdft_end(is->rdft); | ||||
@@ -3509,7 +3509,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); | |||||
/** | /** | ||||
* Allocate an AVFrame and set its fields to default values. The resulting | * Allocate an AVFrame and set its fields to default values. The resulting | ||||
* struct can be deallocated by simply calling av_free(). | |||||
* struct must be freed using avcodec_free_frame(). | |||||
* | * | ||||
* @return An AVFrame filled with default values or NULL on failure. | * @return An AVFrame filled with default values or NULL on failure. | ||||
* @see avcodec_get_frame_defaults | * @see avcodec_get_frame_defaults | ||||
@@ -3519,9 +3519,21 @@ AVFrame *avcodec_alloc_frame(void); | |||||
/** | /** | ||||
* Set the fields of the given AVFrame to default values. | * Set the fields of the given AVFrame to default values. | ||||
* | * | ||||
* @param pic The AVFrame of which the fields should be set to default values. | |||||
* @param frame The AVFrame of which the fields should be set to default values. | |||||
*/ | */ | ||||
void avcodec_get_frame_defaults(AVFrame *pic); | |||||
void avcodec_get_frame_defaults(AVFrame *frame); | |||||
/** | |||||
* Free the frame and any dynamically allocated objects in it, | |||||
* e.g. extended_data. | |||||
* | |||||
* @param frame frame to be freed. The pointer will be set to NULL. | |||||
* | |||||
* @warning this function does NOT free the data buffers themselves | |||||
* (it does not know how, since they might have been allocated with | |||||
* a custom get_buffer()). | |||||
*/ | |||||
void avcodec_free_frame(AVFrame **frame); | |||||
#if FF_API_AVCODEC_OPEN | #if FF_API_AVCODEC_OPEN | ||||
/** | /** | ||||
@@ -694,6 +694,7 @@ static const AVCodecDefault x264_defaults[] = { | |||||
{ "cmp", "-1" }, | { "cmp", "-1" }, | ||||
{ "threads", AV_STRINGIFY(X264_THREADS_AUTO) }, | { "threads", AV_STRINGIFY(X264_THREADS_AUTO) }, | ||||
{ "thread_type", "0" }, | { "thread_type", "0" }, | ||||
{ "flags", "+cgop" }, | |||||
{ NULL }, | { NULL }, | ||||
}; | }; | ||||
@@ -695,31 +695,54 @@ enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum | |||||
return fmt[0]; | return fmt[0]; | ||||
} | } | ||||
void avcodec_get_frame_defaults(AVFrame *pic) | |||||
void avcodec_get_frame_defaults(AVFrame *frame) | |||||
{ | { | ||||
memset(pic, 0, sizeof(AVFrame)); | |||||
#if LIBAVCODEC_VERSION_MAJOR >= 55 | |||||
// extended_data should explicitly be freed when needed, this code is unsafe currently | |||||
// also this is not compatible to the <55 ABI/API | |||||
if (frame->extended_data != frame->data && 0) | |||||
av_freep(&frame->extended_data); | |||||
#endif | |||||
pic->pts = | |||||
pic->pkt_dts = | |||||
pic->pkt_pts = | |||||
pic->best_effort_timestamp = AV_NOPTS_VALUE; | |||||
pic->pkt_duration = 0; | |||||
pic->pkt_pos = -1; | |||||
pic->key_frame = 1; | |||||
pic->sample_aspect_ratio = (AVRational) {0, 1 }; | |||||
pic->format = -1; /* unknown */ | |||||
memset(frame, 0, sizeof(AVFrame)); | |||||
frame->pts = | |||||
frame->pkt_dts = | |||||
frame->pkt_pts = | |||||
frame->best_effort_timestamp = AV_NOPTS_VALUE; | |||||
frame->pkt_duration = 0; | |||||
frame->pkt_pos = -1; | |||||
frame->key_frame = 1; | |||||
frame->sample_aspect_ratio = (AVRational) {0, 1 }; | |||||
frame->format = -1; /* unknown */ | |||||
frame->extended_data = frame->data; | |||||
} | } | ||||
AVFrame *avcodec_alloc_frame(void) | AVFrame *avcodec_alloc_frame(void) | ||||
{ | { | ||||
AVFrame *pic = av_malloc(sizeof(AVFrame)); | |||||
AVFrame *frame = av_mallocz(sizeof(AVFrame)); | |||||
if (pic == NULL) | |||||
if (frame == NULL) | |||||
return NULL; | return NULL; | ||||
avcodec_get_frame_defaults(pic); | |||||
avcodec_get_frame_defaults(frame); | |||||
return pic; | |||||
return frame; | |||||
} | |||||
void avcodec_free_frame(AVFrame **frame) | |||||
{ | |||||
AVFrame *f; | |||||
if (!frame || !*frame) | |||||
return; | |||||
f = *frame; | |||||
if (f->extended_data != f->data) | |||||
av_freep(&f->extended_data); | |||||
av_freep(frame); | |||||
} | } | ||||
#define MAKE_ACCESSORS(str, name, type, field) \ | #define MAKE_ACCESSORS(str, name, type, field) \ | ||||
@@ -1572,6 +1595,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi | |||||
} else | } else | ||||
ret = 0; | ret = 0; | ||||
/* many decoders assign whole AVFrames, thus overwriting extended_data; | |||||
* make sure it's set correctly */ | |||||
picture->extended_data = picture->data; | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -1629,6 +1656,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, | |||||
int *got_frame_ptr, | int *got_frame_ptr, | ||||
const AVPacket *avpkt) | const AVPacket *avpkt) | ||||
{ | { | ||||
int planar, channels; | |||||
int ret = 0; | int ret = 0; | ||||
*got_frame_ptr = 0; | *got_frame_ptr = 0; | ||||
@@ -1710,6 +1738,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, | |||||
ret = avpkt->size; | ret = avpkt->size; | ||||
} | } | ||||
} | } | ||||
/* many decoders assign whole AVFrames, thus overwriting extended_data; | |||||
* make sure it's set correctly; assume decoders that actually use | |||||
* extended_data are doing it correctly */ | |||||
planar = av_sample_fmt_is_planar(frame->format); | |||||
channels = av_get_channel_layout_nb_channels(frame->channel_layout); | |||||
if (!(planar && channels > AV_NUM_DATA_POINTERS)) | |||||
frame->extended_data = frame->data; | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -27,7 +27,7 @@ | |||||
*/ | */ | ||||
#define LIBAVCODEC_VERSION_MAJOR 54 | #define LIBAVCODEC_VERSION_MAJOR 54 | ||||
#define LIBAVCODEC_VERSION_MINOR 58 | |||||
#define LIBAVCODEC_VERSION_MINOR 59 | |||||
#define LIBAVCODEC_VERSION_MICRO 100 | #define LIBAVCODEC_VERSION_MICRO 100 | ||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | ||||
@@ -336,7 +336,7 @@ static av_cold void movie_uninit(AVFilterContext *ctx) | |||||
av_freep(&movie->file_name); | av_freep(&movie->file_name); | ||||
av_freep(&movie->st); | av_freep(&movie->st); | ||||
av_freep(&movie->out_index); | av_freep(&movie->out_index); | ||||
av_freep(&movie->frame); | |||||
avcodec_free_frame(&movie->frame); | |||||
if (movie->format_ctx) | if (movie->format_ctx) | ||||
avformat_close_input(&movie->format_ctx); | avformat_close_input(&movie->format_ctx); | ||||
} | } | ||||
@@ -485,6 +485,7 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize, | |||||
s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos); | s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos); | ||||
} | } | ||||
}else{ | }else{ | ||||
os->nb_header++; | |||||
os->pstart += os->psize; | os->pstart += os->psize; | ||||
os->psize = 0; | os->psize = 0; | ||||
} | } | ||||
@@ -51,6 +51,10 @@ struct ogg_codec { | |||||
* 0 if granule is the end time of the associated packet. | * 0 if granule is the end time of the associated packet. | ||||
*/ | */ | ||||
int granule_is_start; | int granule_is_start; | ||||
/** | |||||
* Number of expected headers | |||||
*/ | |||||
int nb_header; | |||||
}; | }; | ||||
struct ogg_stream { | struct ogg_stream { | ||||
@@ -77,6 +81,7 @@ struct ogg_stream { | |||||
int keyframe_seek; | int keyframe_seek; | ||||
int got_start; | int got_start; | ||||
int got_data; ///< 1 if the stream got some data (non-initial packets), 0 otherwise | int got_data; ///< 1 if the stream got some data (non-initial packets), 0 otherwise | ||||
int nb_header; ///< set to the number of parsed headers | |||||
void *private; | void *private; | ||||
}; | }; | ||||
@@ -93,4 +93,5 @@ const struct ogg_codec ff_celt_codec = { | |||||
.magic = "CELT ", | .magic = "CELT ", | ||||
.magicsize = 8, | .magicsize = 8, | ||||
.header = celt_header, | .header = celt_header, | ||||
.nb_header = 2, | |||||
}; | }; |
@@ -104,6 +104,7 @@ const struct ogg_codec ff_dirac_codec = { | |||||
.header = dirac_header, | .header = dirac_header, | ||||
.gptopts = dirac_gptopts, | .gptopts = dirac_gptopts, | ||||
.granule_is_start = 1, | .granule_is_start = 1, | ||||
.nb_header = 1, | |||||
}; | }; | ||||
const struct ogg_codec ff_old_dirac_codec = { | const struct ogg_codec ff_old_dirac_codec = { | ||||
@@ -112,4 +113,5 @@ const struct ogg_codec ff_old_dirac_codec = { | |||||
.header = old_dirac_header, | .header = old_dirac_header, | ||||
.gptopts = old_dirac_gptopts, | .gptopts = old_dirac_gptopts, | ||||
.granule_is_start = 1, | .granule_is_start = 1, | ||||
.nb_header = 1, | |||||
}; | }; |
@@ -88,11 +88,13 @@ old_flac_header (AVFormatContext * s, int idx) | |||||
const struct ogg_codec ff_flac_codec = { | const struct ogg_codec ff_flac_codec = { | ||||
.magic = "\177FLAC", | .magic = "\177FLAC", | ||||
.magicsize = 5, | .magicsize = 5, | ||||
.header = flac_header | |||||
.header = flac_header, | |||||
.nb_header = 2, | |||||
}; | }; | ||||
const struct ogg_codec ff_old_flac_codec = { | const struct ogg_codec ff_old_flac_codec = { | ||||
.magic = "fLaC", | .magic = "fLaC", | ||||
.magicsize = 4, | .magicsize = 4, | ||||
.header = old_flac_header | |||||
.header = old_flac_header, | |||||
.nb_header = 0, | |||||
}; | }; |
@@ -171,6 +171,7 @@ const struct ogg_codec ff_ogm_video_codec = { | |||||
.header = ogm_header, | .header = ogm_header, | ||||
.packet = ogm_packet, | .packet = ogm_packet, | ||||
.granule_is_start = 1, | .granule_is_start = 1, | ||||
.nb_header = 2, | |||||
}; | }; | ||||
const struct ogg_codec ff_ogm_audio_codec = { | const struct ogg_codec ff_ogm_audio_codec = { | ||||
@@ -179,6 +180,7 @@ const struct ogg_codec ff_ogm_audio_codec = { | |||||
.header = ogm_header, | .header = ogm_header, | ||||
.packet = ogm_packet, | .packet = ogm_packet, | ||||
.granule_is_start = 1, | .granule_is_start = 1, | ||||
.nb_header = 2, | |||||
}; | }; | ||||
const struct ogg_codec ff_ogm_text_codec = { | const struct ogg_codec ff_ogm_text_codec = { | ||||
@@ -187,6 +189,7 @@ const struct ogg_codec ff_ogm_text_codec = { | |||||
.header = ogm_header, | .header = ogm_header, | ||||
.packet = ogm_packet, | .packet = ogm_packet, | ||||
.granule_is_start = 1, | .granule_is_start = 1, | ||||
.nb_header = 2, | |||||
}; | }; | ||||
const struct ogg_codec ff_ogm_old_codec = { | const struct ogg_codec ff_ogm_old_codec = { | ||||
@@ -195,4 +198,5 @@ const struct ogg_codec ff_ogm_old_codec = { | |||||
.header = ogm_dshow_header, | .header = ogm_dshow_header, | ||||
.packet = ogm_packet, | .packet = ogm_packet, | ||||
.granule_is_start = 1, | .granule_is_start = 1, | ||||
.nb_header = 1, | |||||
}; | }; |
@@ -89,4 +89,5 @@ const struct ogg_codec ff_skeleton_codec = { | |||||
.magic = "fishead", | .magic = "fishead", | ||||
.magicsize = 8, | .magicsize = 8, | ||||
.header = skeleton_header, | .header = skeleton_header, | ||||
.nb_header = 0, | |||||
}; | }; |
@@ -122,5 +122,6 @@ const struct ogg_codec ff_speex_codec = { | |||||
.magic = "Speex ", | .magic = "Speex ", | ||||
.magicsize = 8, | .magicsize = 8, | ||||
.header = speex_header, | .header = speex_header, | ||||
.packet = speex_packet | |||||
.packet = speex_packet, | |||||
.nb_header = 2, | |||||
}; | }; |
@@ -192,5 +192,6 @@ const struct ogg_codec ff_theora_codec = { | |||||
.magicsize = 7, | .magicsize = 7, | ||||
.header = theora_header, | .header = theora_header, | ||||
.packet = theora_packet, | .packet = theora_packet, | ||||
.gptopts = theora_gptopts | |||||
.gptopts = theora_gptopts, | |||||
.nb_header = 3, | |||||
}; | }; |
@@ -367,4 +367,5 @@ const struct ogg_codec ff_vorbis_codec = { | |||||
.magicsize = 7, | .magicsize = 7, | ||||
.header = vorbis_header, | .header = vorbis_header, | ||||
.packet = vorbis_packet, | .packet = vorbis_packet, | ||||
.nb_header = 3, | |||||
}; | }; |
@@ -2346,10 +2346,13 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option | |||||
{ | { | ||||
const AVCodec *codec; | const AVCodec *codec; | ||||
int got_picture = 1, ret = 0; | int got_picture = 1, ret = 0; | ||||
AVFrame picture; | |||||
AVFrame *frame = avcodec_alloc_frame(); | |||||
AVSubtitle subtitle; | AVSubtitle subtitle; | ||||
AVPacket pkt = *avpkt; | AVPacket pkt = *avpkt; | ||||
if (!frame) | |||||
return AVERROR(ENOMEM); | |||||
if (!avcodec_is_open(st->codec) && !st->info->found_decoder) { | if (!avcodec_is_open(st->codec) && !st->info->found_decoder) { | ||||
AVDictionary *thread_opt = NULL; | AVDictionary *thread_opt = NULL; | ||||
@@ -2358,7 +2361,8 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option | |||||
if (!codec) { | if (!codec) { | ||||
st->info->found_decoder = -1; | st->info->found_decoder = -1; | ||||
return -1; | |||||
ret = -1; | |||||
goto fail; | |||||
} | } | ||||
/* force thread count to 1 since the h264 decoder will not extract SPS | /* force thread count to 1 since the h264 decoder will not extract SPS | ||||
@@ -2369,14 +2373,16 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option | |||||
av_dict_free(&thread_opt); | av_dict_free(&thread_opt); | ||||
if (ret < 0) { | if (ret < 0) { | ||||
st->info->found_decoder = -1; | st->info->found_decoder = -1; | ||||
return ret; | |||||
goto fail; | |||||
} | } | ||||
st->info->found_decoder = 1; | st->info->found_decoder = 1; | ||||
} else if (!st->info->found_decoder) | } else if (!st->info->found_decoder) | ||||
st->info->found_decoder = 1; | st->info->found_decoder = 1; | ||||
if (st->info->found_decoder < 0) | |||||
return -1; | |||||
if (st->info->found_decoder < 0) { | |||||
ret = -1; | |||||
goto fail; | |||||
} | |||||
while ((pkt.size > 0 || (!pkt.data && got_picture)) && | while ((pkt.size > 0 || (!pkt.data && got_picture)) && | ||||
ret >= 0 && | ret >= 0 && | ||||
@@ -2384,14 +2390,14 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option | |||||
!has_decode_delay_been_guessed(st) || | !has_decode_delay_been_guessed(st) || | ||||
(!st->codec_info_nb_frames && st->codec->codec->capabilities & CODEC_CAP_CHANNEL_CONF))) { | (!st->codec_info_nb_frames && st->codec->codec->capabilities & CODEC_CAP_CHANNEL_CONF))) { | ||||
got_picture = 0; | got_picture = 0; | ||||
avcodec_get_frame_defaults(&picture); | |||||
avcodec_get_frame_defaults(frame); | |||||
switch(st->codec->codec_type) { | switch(st->codec->codec_type) { | ||||
case AVMEDIA_TYPE_VIDEO: | case AVMEDIA_TYPE_VIDEO: | ||||
ret = avcodec_decode_video2(st->codec, &picture, | |||||
ret = avcodec_decode_video2(st->codec, frame, | |||||
&got_picture, &pkt); | &got_picture, &pkt); | ||||
break; | break; | ||||
case AVMEDIA_TYPE_AUDIO: | case AVMEDIA_TYPE_AUDIO: | ||||
ret = avcodec_decode_audio4(st->codec, &picture, &got_picture, &pkt); | |||||
ret = avcodec_decode_audio4(st->codec, frame, &got_picture, &pkt); | |||||
break; | break; | ||||
case AVMEDIA_TYPE_SUBTITLE: | case AVMEDIA_TYPE_SUBTITLE: | ||||
ret = avcodec_decode_subtitle2(st->codec, &subtitle, | ret = avcodec_decode_subtitle2(st->codec, &subtitle, | ||||
@@ -2409,8 +2415,12 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option | |||||
ret = got_picture; | ret = got_picture; | ||||
} | } | ||||
} | } | ||||
if(!pkt.data && !got_picture) | if(!pkt.data && !got_picture) | ||||
return -1; | |||||
ret = -1; | |||||
fail: | |||||
avcodec_free_frame(&frame); | |||||
return ret; | return ret; | ||||
} | } | ||||