Merge commit '4c0588b4562abad5540f6a5435c62828de9e4fdf'
authorJames Almer <jamrial@gmail.com>
Sat, 11 Nov 2017 04:24:55 +0000 (01:24 -0300)
committerJames Almer <jamrial@gmail.com>
Sat, 11 Nov 2017 04:24:55 +0000 (01:24 -0300)
* commit '4c0588b4562abad5540f6a5435c62828de9e4fdf':
  mpeg2enc: Don't mark all streams as component video

Merged-by: James Almer <jamrial@gmail.com>
1  2 
libavcodec/mpeg12enc.c

@@@ -332,37 -292,20 +332,37 @@@ static void mpeg1_encode_sequence_heade
              put_bits(&s->pb, 1, 1);                 // marker
              put_bits(&s->pb, 8, vbv_buffer_size >> 10); // vbv buffer ext
              put_bits(&s->pb, 1, s->low_delay);
 -            put_bits(&s->pb, 2, 0);                 // frame_rate_ext_n
 -            put_bits(&s->pb, 5, 0);                 // frame_rate_ext_d
 +            put_bits(&s->pb, 2, s->mpeg2_frame_rate_ext.num-1); // frame_rate_ext_n
 +            put_bits(&s->pb, 5, s->mpeg2_frame_rate_ext.den-1); // frame_rate_ext_d
 +
 +            side_data = av_frame_get_side_data(s->current_picture_ptr->f, AV_FRAME_DATA_PANSCAN);
 +            if (side_data) {
 +                AVPanScan *pan_scan = (AVPanScan *)side_data->data;
 +                if (pan_scan->width && pan_scan->height) {
 +                    width = pan_scan->width >> 4;
 +                    height = pan_scan->height >> 4;
 +                }
 +            }
  
 -            put_header(s, EXT_START_CODE);
 -            put_bits(&s->pb, 4, 2);                         // sequence display extension
 -            put_bits(&s->pb, 3, 5);                         // video_format: 5 is unspecified
 -            put_bits(&s->pb, 1, 1);                         // colour_description
 -            put_bits(&s->pb, 8, s->avctx->color_primaries); // colour_primaries
 -            put_bits(&s->pb, 8, s->avctx->color_trc);       // transfer_characteristics
 -            put_bits(&s->pb, 8, s->avctx->colorspace);      // matrix_coefficients
 -            put_bits(&s->pb, 14, s->width);                 // display_horizontal_size
 -            put_bits(&s->pb, 1, 1);                         // marker_bit
 -            put_bits(&s->pb, 14, s->height);                // display_vertical_size
 -            put_bits(&s->pb, 3, 0);                         // remaining 3 bits are zero padding
 +            use_seq_disp_ext = (width != s->width ||
 +                                height != s->height ||
 +                                s->avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
 +                                s->avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
 +                                s->avctx->colorspace != AVCOL_SPC_UNSPECIFIED);
 +
 +            if (s->seq_disp_ext == 1 || (s->seq_disp_ext == -1 && use_seq_disp_ext)) {
 +                put_header(s, EXT_START_CODE);
 +                put_bits(&s->pb, 4, 2);                         // sequence display extension
-                 put_bits(&s->pb, 3, 0);                         // video_format: 0 is components
++                put_bits(&s->pb, 3, 5);                         // video_format: 5 is unspecified
 +                put_bits(&s->pb, 1, 1);                         // colour_description
 +                put_bits(&s->pb, 8, s->avctx->color_primaries); // colour_primaries
 +                put_bits(&s->pb, 8, s->avctx->color_trc);       // transfer_characteristics
 +                put_bits(&s->pb, 8, s->avctx->colorspace);      // matrix_coefficients
 +                put_bits(&s->pb, 14, width);                    // display_horizontal_size
 +                put_bits(&s->pb, 1, 1);                         // marker_bit
 +                put_bits(&s->pb, 14, height);                   // display_vertical_size
 +                put_bits(&s->pb, 3, 0);                         // remaining 3 bits are zero padding
 +            }
          }
  
          put_header(s, GOP_START_CODE);