Message ID | 20170830051433.3312-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 9a174d203ae42cc03360c695c70066d6eb1058db |
Headers | show |
On 8/30/2017 2:14 AM, James Almer wrote: > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavfilter/lavfutils.c | 20 +++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) Ping.
On Mon, 4 Sep 2017 00:04:36 -0300 James Almer <jamrial@gmail.com> wrote: > On 8/30/2017 2:14 AM, James Almer wrote: > > Signed-off-by: James Almer <jamrial@gmail.com> > > --- > > libavfilter/lavfutils.c | 20 +++++++++++++++++--- > > 1 file changed, 17 insertions(+), 3 deletions(-) > > Ping. Just push it.
> Am 04.09.2017 um 05:04 schrieb James Almer <jamrial@gmail.com>: > >> On 8/30/2017 2:14 AM, James Almer wrote: >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavfilter/lavfutils.c | 20 +++++++++++++++++--- >> 1 file changed, 17 insertions(+), 3 deletions(-) > > Ping. Please allow more time for testing. Thank you, Carl Eugen
On 9/4/17, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote: > > >> Am 04.09.2017 um 05:04 schrieb James Almer <jamrial@gmail.com>: >> >>> On 8/30/2017 2:14 AM, James Almer wrote: >>> Signed-off-by: James Almer <jamrial@gmail.com> >>> --- >>> libavfilter/lavfutils.c | 20 +++++++++++++++++--- >>> 1 file changed, 17 insertions(+), 3 deletions(-) >> >> Ping. > > Please allow more time for testing. How much time is enough time for you?
On 9/4/2017 6:36 AM, wm4 wrote: > On Mon, 4 Sep 2017 00:04:36 -0300 > James Almer <jamrial@gmail.com> wrote: > >> On 8/30/2017 2:14 AM, James Almer wrote: >>> Signed-off-by: James Almer <jamrial@gmail.com> >>> --- >>> libavfilter/lavfutils.c | 20 +++++++++++++++++--- >>> 1 file changed, 17 insertions(+), 3 deletions(-) >> >> Ping. > > Just push it. Was waiting for some libavfilter savvy users/devs like Paul and Nicolas to comment, but seeing Paul just agreed with you I'll push it later today or tomorrow.
On 9/4/2017 11:18 AM, James Almer wrote: > On 9/4/2017 6:36 AM, wm4 wrote: >> On Mon, 4 Sep 2017 00:04:36 -0300 >> James Almer <jamrial@gmail.com> wrote: >> >>> On 8/30/2017 2:14 AM, James Almer wrote: >>>> Signed-off-by: James Almer <jamrial@gmail.com> >>>> --- >>>> libavfilter/lavfutils.c | 20 +++++++++++++++++--- >>>> 1 file changed, 17 insertions(+), 3 deletions(-) >>> >>> Ping. >> >> Just push it. > > Was waiting for some libavfilter savvy users/devs like Paul and Nicolas > to comment, but seeing Paul just agreed with you I'll push it later > today or tomorrow. Pushed.
diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c index 35878b3d50..b6319cf027 100644 --- a/libavfilter/lavfutils.c +++ b/libavfilter/lavfutils.c @@ -29,6 +29,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], AVFormatContext *format_ctx = NULL; AVCodec *codec; AVCodecContext *codec_ctx; + AVCodecParameters *par; AVFrame *frame; int frame_decoded, ret = 0; AVPacket pkt; @@ -50,14 +51,27 @@ int ff_load_image(uint8_t *data[4], int linesize[4], return ret; } - codec_ctx = format_ctx->streams[0]->codec; - codec = avcodec_find_decoder(codec_ctx->codec_id); + par = format_ctx->streams[0]->codecpar; + codec = avcodec_find_decoder(par->codec_id); if (!codec) { av_log(log_ctx, AV_LOG_ERROR, "Failed to find codec\n"); ret = AVERROR(EINVAL); goto end; } + codec_ctx = avcodec_alloc_context3(codec); + if (!codec_ctx) { + av_log(log_ctx, AV_LOG_ERROR, "Failed to alloc video decoder context\n"); + ret = AVERROR(ENOMEM); + goto end; + } + + ret = avcodec_parameters_to_context(codec_ctx, par); + if (ret < 0) { + av_log(log_ctx, AV_LOG_ERROR, "Failed to copy codec parameters to decoder context\n"); + goto end; + } + av_dict_set(&opt, "thread_type", "slice", 0); if ((ret = avcodec_open2(codec_ctx, codec, &opt)) < 0) { av_log(log_ctx, AV_LOG_ERROR, "Failed to open codec\n"); @@ -96,7 +110,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], end: av_packet_unref(&pkt); - avcodec_close(codec_ctx); + avcodec_free_context(&codec_ctx); avformat_close_input(&format_ctx); av_frame_free(&frame); av_dict_free(&opt);
Signed-off-by: James Almer <jamrial@gmail.com> --- libavfilter/lavfutils.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)