Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-02-01 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Li, Zhong
> Sent: Tuesday, January 30, 2018 10:06 AM
> To: FFmpeg development discussions and patches
> <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> AVCodecParameters
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> Behalf
> > Of Michael Niedermayer
> > Sent: Friday, January 26, 2018 11:56 PM
> > To: FFmpeg development discussions and patches
> > <ffmpeg-devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> > AVCodecParameters
> >
> > On Fri, Jan 19, 2018 at 01:15:13PM -0300, James Almer wrote:
> > > On 1/19/2018 7:12 AM, Hendrik Leppkes wrote:
> > > > On Fri, Jan 19, 2018 at 4:19 AM, Li, Zhong <zhong...@intel.com> wrote:
> > > >>> -Original Message-
> > > >>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > > >>> Behalf Of James Almer
> > > >>> Sent: Thursday, January 18, 2018 1:15 PM
> > > >>> To: ffmpeg-devel@ffmpeg.org
> > > >>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> > > >>> AVCodecParameters
> > > >>>
> > > >>> On 1/18/2018 2:03 AM, Zhong Li wrote:
> > > >>>> coded_width/height may be different from width/height sometimes
> > > >>>
> > > >>>> (e.g, crop or lowres cases).
> > > >>>
> > > >>> Which is why it's not a field that belongs to AVCodecParameters.
> > > >>>
> > > >>> Codec level cropping has nothing to do with containers. Same
> > > >>> with lowres, which is an internal feature, and scheduled for removal.
> > > >>
> > > >> Got it. How about fixing ticket #6958 as below?
> > > >>
> > > >> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index
> > > >> 0e7a771..233760d 100644
> > > >> --- a/fftools/ffprobe.c
> > > >> +++ b/fftools/ffprobe.c
> > > >> @@ -2512,10 +2512,12 @@ static int show_stream(WriterContext
> *w,
> > AVFormatContext *fmt_ctx, int stream_id
> > > >>  case AVMEDIA_TYPE_VIDEO:
> > > >>  print_int("width",par->width);
> > > >>  print_int("height",   par->height);
> > > >> +#if FF_API_LAVF_AVCTX
> > > >>  if (dec_ctx) {
> > > >>  print_int("coded_width",  dec_ctx->coded_width);
> > > >>  print_int("coded_height", dec_ctx->coded_height);
> > > >>  }
> > > >> +#endif
> > > >>  print_int("has_b_frames", par->video_delay);
> > > >>  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream,
> > NULL);
> > > >>  if (sar.den) {
> > > >> @@ -2912,6 +2914,10 @@ static int open_input_file(InputFile
> > > >> *ifile, const char *filename)
> > > >>
> > > >>  ist->dec_ctx->pkt_timebase = stream->time_base;
> > > >>  ist->dec_ctx->framerate = stream->avg_frame_rate;
> > > >> +#if FF_API_LAVF_AVCTX
> > > >> +ist->dec_ctx->coded_width =
> > stream->codec->coded_width;
> > > >> +ist->dec_ctx->coded_height =
> > > >> +stream->codec->coded_height; #endif
> > > >>
> > > >
> > > > As mentioned in the thread for that patch already, writing new
> > > > code using deprecated API should really be avoided.
> > > >
> > > > The way I see it, if someone really needs to know coded w/h (which
> > > > is typically an internal technical detail of no relevance to
> > > > users), they should decode a frame and get it from the decoder.
> > > >
> > > > - Hendrik
> > >
> > > This specific approach is IMO acceptable. It basically recovers the
> > > pre-codecpar behavior until AVStream->codec is removed, and
> > > effectively fixes the "regression".
> > > Once that's gone, ffprobe will stop reporting coded_width/height
> > > altogether instead of doing so with a bogus value, as everything is
> > > being wrapped in the proper checks.
> >
> > +1
> >
> > [...]
> > --
> > Michael GnuPG fingerprint:
> > 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Thanks for Hendrik/James/ Michael's review.
> Will this patch be applied? (Another thread maybe easier to apply:
> https://patchwork.ffmpeg.org/patch/7344/ )

Ping.
I see the priority of ticket #6958 has been set as "important". 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-29 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Michael Niedermayer
> Sent: Friday, January 26, 2018 11:56 PM
> To: FFmpeg development discussions and patches
> <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> AVCodecParameters
> 
> On Fri, Jan 19, 2018 at 01:15:13PM -0300, James Almer wrote:
> > On 1/19/2018 7:12 AM, Hendrik Leppkes wrote:
> > > On Fri, Jan 19, 2018 at 4:19 AM, Li, Zhong <zhong...@intel.com> wrote:
> > >>> -Original Message-
> > >>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > >>> Behalf Of James Almer
> > >>> Sent: Thursday, January 18, 2018 1:15 PM
> > >>> To: ffmpeg-devel@ffmpeg.org
> > >>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> > >>> AVCodecParameters
> > >>>
> > >>> On 1/18/2018 2:03 AM, Zhong Li wrote:
> > >>>> coded_width/height may be different from width/height sometimes
> > >>>
> > >>>> (e.g, crop or lowres cases).
> > >>>
> > >>> Which is why it's not a field that belongs to AVCodecParameters.
> > >>>
> > >>> Codec level cropping has nothing to do with containers. Same with
> > >>> lowres, which is an internal feature, and scheduled for removal.
> > >>
> > >> Got it. How about fixing ticket #6958 as below?
> > >>
> > >> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index
> > >> 0e7a771..233760d 100644
> > >> --- a/fftools/ffprobe.c
> > >> +++ b/fftools/ffprobe.c
> > >> @@ -2512,10 +2512,12 @@ static int show_stream(WriterContext *w,
> AVFormatContext *fmt_ctx, int stream_id
> > >>  case AVMEDIA_TYPE_VIDEO:
> > >>  print_int("width",par->width);
> > >>  print_int("height",   par->height);
> > >> +#if FF_API_LAVF_AVCTX
> > >>  if (dec_ctx) {
> > >>  print_int("coded_width",  dec_ctx->coded_width);
> > >>  print_int("coded_height", dec_ctx->coded_height);
> > >>  }
> > >> +#endif
> > >>  print_int("has_b_frames", par->video_delay);
> > >>  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream,
> NULL);
> > >>  if (sar.den) {
> > >> @@ -2912,6 +2914,10 @@ static int open_input_file(InputFile *ifile,
> > >> const char *filename)
> > >>
> > >>  ist->dec_ctx->pkt_timebase = stream->time_base;
> > >>  ist->dec_ctx->framerate = stream->avg_frame_rate;
> > >> +#if FF_API_LAVF_AVCTX
> > >> +ist->dec_ctx->coded_width =
> stream->codec->coded_width;
> > >> +ist->dec_ctx->coded_height =
> > >> +stream->codec->coded_height; #endif
> > >>
> > >
> > > As mentioned in the thread for that patch already, writing new code
> > > using deprecated API should really be avoided.
> > >
> > > The way I see it, if someone really needs to know coded w/h (which
> > > is typically an internal technical detail of no relevance to users),
> > > they should decode a frame and get it from the decoder.
> > >
> > > - Hendrik
> >
> > This specific approach is IMO acceptable. It basically recovers the
> > pre-codecpar behavior until AVStream->codec is removed, and
> > effectively fixes the "regression".
> > Once that's gone, ffprobe will stop reporting coded_width/height
> > altogether instead of doing so with a bogus value, as everything is
> > being wrapped in the proper checks.
> 
> +1
> 
> [...]
> --
> Michael GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB

Thanks for Hendrik/James/ Michael's review. 
Will this patch be applied? (Another thread maybe easier to apply: 
https://patchwork.ffmpeg.org/patch/7344/ ) 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-26 Thread Michael Niedermayer
On Fri, Jan 19, 2018 at 01:15:13PM -0300, James Almer wrote:
> On 1/19/2018 7:12 AM, Hendrik Leppkes wrote:
> > On Fri, Jan 19, 2018 at 4:19 AM, Li, Zhong <zhong...@intel.com> wrote:
> >>> -Original Message-
> >>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> >>> Of James Almer
> >>> Sent: Thursday, January 18, 2018 1:15 PM
> >>> To: ffmpeg-devel@ffmpeg.org
> >>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> >>> AVCodecParameters
> >>>
> >>> On 1/18/2018 2:03 AM, Zhong Li wrote:
> >>>> coded_width/height may be different from width/height sometimes
> >>>
> >>>> (e.g, crop or lowres cases).
> >>>
> >>> Which is why it's not a field that belongs to AVCodecParameters.
> >>>
> >>> Codec level cropping has nothing to do with containers. Same with lowres,
> >>> which is an internal feature, and scheduled for removal.
> >>
> >> Got it. How about fixing ticket #6958 as below?
> >>
> >> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> >> index 0e7a771..233760d 100644
> >> --- a/fftools/ffprobe.c
> >> +++ b/fftools/ffprobe.c
> >> @@ -2512,10 +2512,12 @@ static int show_stream(WriterContext *w, 
> >> AVFormatContext *fmt_ctx, int stream_id
> >>  case AVMEDIA_TYPE_VIDEO:
> >>  print_int("width",par->width);
> >>  print_int("height",   par->height);
> >> +#if FF_API_LAVF_AVCTX
> >>  if (dec_ctx) {
> >>  print_int("coded_width",  dec_ctx->coded_width);
> >>  print_int("coded_height", dec_ctx->coded_height);
> >>  }
> >> +#endif
> >>  print_int("has_b_frames", par->video_delay);
> >>  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
> >>  if (sar.den) {
> >> @@ -2912,6 +2914,10 @@ static int open_input_file(InputFile *ifile, const 
> >> char *filename)
> >>
> >>  ist->dec_ctx->pkt_timebase = stream->time_base;
> >>  ist->dec_ctx->framerate = stream->avg_frame_rate;
> >> +#if FF_API_LAVF_AVCTX
> >> +ist->dec_ctx->coded_width = stream->codec->coded_width;
> >> +ist->dec_ctx->coded_height = stream->codec->coded_height;
> >> +#endif
> >>
> > 
> > As mentioned in the thread for that patch already, writing new code
> > using deprecated API should really be avoided.
> > 
> > The way I see it, if someone really needs to know coded w/h (which is
> > typically an internal technical detail of no relevance to users), they
> > should decode a frame and get it from the decoder.
> > 
> > - Hendrik
> 
> This specific approach is IMO acceptable. It basically recovers the
> pre-codecpar behavior until AVStream->codec is removed, and effectively
> fixes the "regression".
> Once that's gone, ffprobe will stop reporting coded_width/height
> altogether instead of doing so with a bogus value, as everything is
> being wrapped in the proper checks.

+1

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-21 Thread Li, Zhong
> 
> As mentioned in the thread for that patch already, writing new code using
> deprecated API should really be avoided.
> 
> The way I see it, if someone really needs to know coded w/h (which is
> typically an internal technical detail of no relevance to users), they should
> decode a frame and get it from the decoder.

James posted some comments on https://patchwork.ffmpeg.org/patch/7342/ , please 
let me know if you have any other comment. 
Such code was added to remove printing coded_w/h once the API is removed:
#if FF_API_LAVF_AVCTX
  if (dec_ctx) {
  print_int("coded_width",  dec_ctx->coded_width);
  print_int("coded_height", dec_ctx->coded_height);
  }
+#endif
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-19 Thread James Almer
On 1/19/2018 7:12 AM, Hendrik Leppkes wrote:
> On Fri, Jan 19, 2018 at 4:19 AM, Li, Zhong <zhong...@intel.com> wrote:
>>> -Original Message-
>>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
>>> Of James Almer
>>> Sent: Thursday, January 18, 2018 1:15 PM
>>> To: ffmpeg-devel@ffmpeg.org
>>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
>>> AVCodecParameters
>>>
>>> On 1/18/2018 2:03 AM, Zhong Li wrote:
>>>> coded_width/height may be different from width/height sometimes
>>>
>>>> (e.g, crop or lowres cases).
>>>
>>> Which is why it's not a field that belongs to AVCodecParameters.
>>>
>>> Codec level cropping has nothing to do with containers. Same with lowres,
>>> which is an internal feature, and scheduled for removal.
>>
>> Got it. How about fixing ticket #6958 as below?
>>
>> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
>> index 0e7a771..233760d 100644
>> --- a/fftools/ffprobe.c
>> +++ b/fftools/ffprobe.c
>> @@ -2512,10 +2512,12 @@ static int show_stream(WriterContext *w, 
>> AVFormatContext *fmt_ctx, int stream_id
>>  case AVMEDIA_TYPE_VIDEO:
>>  print_int("width",par->width);
>>  print_int("height",   par->height);
>> +#if FF_API_LAVF_AVCTX
>>  if (dec_ctx) {
>>  print_int("coded_width",  dec_ctx->coded_width);
>>  print_int("coded_height", dec_ctx->coded_height);
>>  }
>> +#endif
>>  print_int("has_b_frames", par->video_delay);
>>  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
>>  if (sar.den) {
>> @@ -2912,6 +2914,10 @@ static int open_input_file(InputFile *ifile, const 
>> char *filename)
>>
>>  ist->dec_ctx->pkt_timebase = stream->time_base;
>>  ist->dec_ctx->framerate = stream->avg_frame_rate;
>> +#if FF_API_LAVF_AVCTX
>> +ist->dec_ctx->coded_width = stream->codec->coded_width;
>> +ist->dec_ctx->coded_height = stream->codec->coded_height;
>> +#endif
>>
> 
> As mentioned in the thread for that patch already, writing new code
> using deprecated API should really be avoided.
> 
> The way I see it, if someone really needs to know coded w/h (which is
> typically an internal technical detail of no relevance to users), they
> should decode a frame and get it from the decoder.
> 
> - Hendrik

This specific approach is IMO acceptable. It basically recovers the
pre-codecpar behavior until AVStream->codec is removed, and effectively
fixes the "regression".
Once that's gone, ffprobe will stop reporting coded_width/height
altogether instead of doing so with a bogus value, as everything is
being wrapped in the proper checks.

The alternative is to remove the two print_int() lines right now, of
course, but i don't think it's the best approach when the above patch is
simple, clean, and local to ffprobe.c (unlike the original suggestion).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-19 Thread Hendrik Leppkes
On Fri, Jan 19, 2018 at 4:19 AM, Li, Zhong <zhong...@intel.com> wrote:
>> -Original Message-
>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
>> Of James Almer
>> Sent: Thursday, January 18, 2018 1:15 PM
>> To: ffmpeg-devel@ffmpeg.org
>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
>> AVCodecParameters
>>
>> On 1/18/2018 2:03 AM, Zhong Li wrote:
>> > coded_width/height may be different from width/height sometimes
>>
>> > (e.g, crop or lowres cases).
>>
>> Which is why it's not a field that belongs to AVCodecParameters.
>>
>> Codec level cropping has nothing to do with containers. Same with lowres,
>> which is an internal feature, and scheduled for removal.
>
> Got it. How about fixing ticket #6958 as below?
>
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 0e7a771..233760d 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -2512,10 +2512,12 @@ static int show_stream(WriterContext *w, 
> AVFormatContext *fmt_ctx, int stream_id
>  case AVMEDIA_TYPE_VIDEO:
>  print_int("width",par->width);
>  print_int("height",   par->height);
> +#if FF_API_LAVF_AVCTX
>  if (dec_ctx) {
>  print_int("coded_width",  dec_ctx->coded_width);
>  print_int("coded_height", dec_ctx->coded_height);
>  }
> +#endif
>  print_int("has_b_frames", par->video_delay);
>  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
>  if (sar.den) {
> @@ -2912,6 +2914,10 @@ static int open_input_file(InputFile *ifile, const 
> char *filename)
>
>  ist->dec_ctx->pkt_timebase = stream->time_base;
>  ist->dec_ctx->framerate = stream->avg_frame_rate;
> +#if FF_API_LAVF_AVCTX
> +ist->dec_ctx->coded_width = stream->codec->coded_width;
> +ist->dec_ctx->coded_height = stream->codec->coded_height;
> +#endif
>

As mentioned in the thread for that patch already, writing new code
using deprecated API should really be avoided.

The way I see it, if someone really needs to know coded w/h (which is
typically an internal technical detail of no relevance to users), they
should decode a frame and get it from the decoder.

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-18 Thread Li, Zhong
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of James Almer
> Sent: Thursday, January 18, 2018 1:15 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> AVCodecParameters
> 
> On 1/18/2018 2:03 AM, Zhong Li wrote:
> > coded_width/height may be different from width/height sometimes
> 
> > (e.g, crop or lowres cases).
> 
> Which is why it's not a field that belongs to AVCodecParameters.
> 
> Codec level cropping has nothing to do with containers. Same with lowres,
> which is an internal feature, and scheduled for removal.

Got it. How about fixing ticket #6958 as below? 

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 0e7a771..233760d 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2512,10 +2512,12 @@ static int show_stream(WriterContext *w, 
AVFormatContext *fmt_ctx, int stream_id
 case AVMEDIA_TYPE_VIDEO:
 print_int("width",par->width);
 print_int("height",   par->height);
+#if FF_API_LAVF_AVCTX
 if (dec_ctx) {
 print_int("coded_width",  dec_ctx->coded_width);
 print_int("coded_height", dec_ctx->coded_height);
 }
+#endif
 print_int("has_b_frames", par->video_delay);
 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
 if (sar.den) {
@@ -2912,6 +2914,10 @@ static int open_input_file(InputFile *ifile, const char 
*filename)

 ist->dec_ctx->pkt_timebase = stream->time_base;
 ist->dec_ctx->framerate = stream->avg_frame_rate;
+#if FF_API_LAVF_AVCTX
+ist->dec_ctx->coded_width = stream->codec->coded_width;
+ist->dec_ctx->coded_height = stream->codec->coded_height;
+#endif

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-18 Thread Hendrik Leppkes
On Thu, Jan 18, 2018 at 6:14 AM, James Almer  wrote:
> On 1/18/2018 2:03 AM, Zhong Li wrote:
>> coded_width/height may be different from width/height sometimes
>
>> (e.g, crop or lowres cases).
>
> Which is why it's not a field that belongs to AVCodecParameters.
>
> Codec level cropping has nothing to do with containers. Same with
> lowres, which is an internal feature, and scheduled for removal.

Indeed, the coded w/h are technical details internal to a codec, and
not relevant as a codec parameter.

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-17 Thread James Almer
On 1/18/2018 2:03 AM, Zhong Li wrote:
> coded_width/height may be different from width/height sometimes

> (e.g, crop or lowres cases).

Which is why it's not a field that belongs to AVCodecParameters.

Codec level cropping has nothing to do with containers. Same with
lowres, which is an internal feature, and scheduled for removal.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-01-17 Thread Zhong Li
coded_width/height may be different from width/height sometimes
(e.g, crop or lowres cases).
ffprobe always show coded_width/height same as width/height since they
are overwritten.
This fixes tiket #6958.

Signed-off-by: Zhong Li 
---
 libavcodec/avcodec.h | 7 +++
 libavcodec/utils.c   | 4 
 libavcodec/version.h | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8fbbc79..710e90c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3905,6 +3905,13 @@ typedef struct AVCodecParameters {
 int height;
 
 /**
+ * Video only. The dimensions of the coded video frame in pixels.
+ *
+ */
+int coded_width;
+int coded_height;
+
+/**
  * Video only. The aspect ratio (width / height) which a single pixel
  * should have when displayed.
  *
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4c71843..427f612 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2147,6 +2147,8 @@ int avcodec_parameters_from_context(AVCodecParameters 
*par,
 par->format  = codec->pix_fmt;
 par->width   = codec->width;
 par->height  = codec->height;
+par->coded_width = codec->coded_width;
+par->coded_height= codec->coded_height;
 par->field_order = codec->field_order;
 par->color_range = codec->color_range;
 par->color_primaries = codec->color_primaries;
@@ -2202,6 +2204,8 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
 codec->pix_fmt= par->format;
 codec->width  = par->width;
 codec->height = par->height;
+codec->coded_width= par->coded_width;
+codec->coded_height   = par->coded_height;
 codec->field_order= par->field_order;
 codec->color_range= par->color_range;
 codec->color_primaries= par->color_primaries;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 47a15d5..ec536bf 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR   9
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
1.8.3.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel