diff mbox

[FFmpeg-devel,1/2] ffmpeg: move some unrelated code out of a filter loop

Message ID 20161024210507.15858-1-u@pkh.me
State Withdrawn
Headers show

Commit Message

Clément Bœsch Oct. 24, 2016, 9:05 p.m. UTC
---
Not sure if the chunk is even needed
---
 ffmpeg.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Clément Bœsch Oct. 29, 2016, 10:03 a.m. UTC | #1
On Mon, Oct 24, 2016 at 11:05:06PM +0200, Clément Bœsch wrote:
> ---
> Not sure if the chunk is even needed
> ---
>  ffmpeg.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 3b91710..e8088c0 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -2317,10 +2317,9 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eo
>      }
>  
>      frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio");
> +    if (!frame_sample_aspect->num)
> +        *frame_sample_aspect = ist->st->sample_aspect_ratio;
>      for (i = 0; i < ist->nb_filters; i++) {
> -        if (!frame_sample_aspect->num)
> -            *frame_sample_aspect = ist->st->sample_aspect_ratio;
> -
>          if (i < ist->nb_filters - 1) {
>              f = ist->filter_frame;
>              err = av_frame_ref(f, decoded_frame);

ping
Andreas Cadhalpun Oct. 29, 2016, 3:35 p.m. UTC | #2
On 29.10.2016 12:03, Clément Bœsch wrote:
> On Mon, Oct 24, 2016 at 11:05:06PM +0200, Clément Bœsch wrote:
>> ---
>> Not sure if the chunk is even needed

I'm not sure either.

>> ---
>>  ffmpeg.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/ffmpeg.c b/ffmpeg.c
>> index 3b91710..e8088c0 100644
>> --- a/ffmpeg.c
>> +++ b/ffmpeg.c
>> @@ -2317,10 +2317,9 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eo
>>      }
>>  
>>      frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio");
>> +    if (!frame_sample_aspect->num)
>> +        *frame_sample_aspect = ist->st->sample_aspect_ratio;
>>      for (i = 0; i < ist->nb_filters; i++) {

This is only entered for 'ist->nb_filters > 0', so to preserve the current behavior,
you'd need to add a check for that.

>> -        if (!frame_sample_aspect->num)
>> -            *frame_sample_aspect = ist->st->sample_aspect_ratio;
>> -
>>          if (i < ist->nb_filters - 1) {
>>              f = ist->filter_frame;
>>              err = av_frame_ref(f, decoded_frame);

Otherwise this is probably OK.

Best regards,
Andreas
Clément Bœsch Nov. 1, 2016, 9:53 a.m. UTC | #3
On Sat, Oct 29, 2016 at 05:35:41PM +0200, Andreas Cadhalpun wrote:
> On 29.10.2016 12:03, Clément Bœsch wrote:
> > On Mon, Oct 24, 2016 at 11:05:06PM +0200, Clément Bœsch wrote:
> >> ---
> >> Not sure if the chunk is even needed
> 
> I'm not sure either.
> 

Now that I look a bit above, I see:

    if (ist->st->sample_aspect_ratio.num)
        decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;

...so I believe the chunk should go away entirely. I just sent a new patch.

Current patch withdrawn.
diff mbox

Patch

diff --git a/ffmpeg.c b/ffmpeg.c
index 3b91710..e8088c0 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2317,10 +2317,9 @@  static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eo
     }
 
     frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio");
+    if (!frame_sample_aspect->num)
+        *frame_sample_aspect = ist->st->sample_aspect_ratio;
     for (i = 0; i < ist->nb_filters; i++) {
-        if (!frame_sample_aspect->num)
-            *frame_sample_aspect = ist->st->sample_aspect_ratio;
-
         if (i < ist->nb_filters - 1) {
             f = ist->filter_frame;
             err = av_frame_ref(f, decoded_frame);