diff mbox

[FFmpeg-devel,1/3] avformat/matroskaenc: support writting Chroma Location elements

Message ID 20161015154056.3148-1-jamrial@gmail.com
State Accepted
Commit bab6b606752e5ba93f9d2d1b71f264dc8e3031b3
Headers show

Commit Message

James Almer Oct. 15, 2016, 3:40 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/matroskaenc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

James Almer Oct. 22, 2016, 8:38 p.m. UTC | #1
On 10/15/2016 12:40 PM, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/matroskaenc.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index a48f5bb..d6557a1 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -829,6 +829,14 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre
>          par->color_range < AVCOL_RANGE_NB) {
>          put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORRANGE, par->color_range);
>      }
> +    if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED &&
> +        par->chroma_location <= AVCHROMA_LOC_TOP) {
> +        int xpos, ypos;
> +
> +        avcodec_enum_to_chroma_pos(&xpos, &ypos, par->chroma_location);
> +        put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 7) + 1);
> +        put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 7) + 1);
> +    }
>      if (side_data_size == sizeof(AVMasteringDisplayMetadata)) {
>          ebml_master meta_element = start_ebml_master(
>              dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0);

Ping.
James Almer Oct. 28, 2016, 3:08 a.m. UTC | #2
On 10/22/2016 5:38 PM, James Almer wrote:
> On 10/15/2016 12:40 PM, James Almer wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavformat/matroskaenc.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>> index a48f5bb..d6557a1 100644
>> --- a/libavformat/matroskaenc.c
>> +++ b/libavformat/matroskaenc.c
>> @@ -829,6 +829,14 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre
>>          par->color_range < AVCOL_RANGE_NB) {
>>          put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORRANGE, par->color_range);
>>      }
>> +    if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED &&
>> +        par->chroma_location <= AVCHROMA_LOC_TOP) {
>> +        int xpos, ypos;
>> +
>> +        avcodec_enum_to_chroma_pos(&xpos, &ypos, par->chroma_location);
>> +        put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 7) + 1);
>> +        put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 7) + 1);
>> +    }
>>      if (side_data_size == sizeof(AVMasteringDisplayMetadata)) {
>>          ebml_master meta_element = start_ebml_master(
>>              dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0);
> 
> Ping.

Ping. Will apply soon if nobody comments.
James Almer Nov. 2, 2016, 8:25 p.m. UTC | #3
On 10/28/2016 12:08 AM, James Almer wrote:
> On 10/22/2016 5:38 PM, James Almer wrote:
>> On 10/15/2016 12:40 PM, James Almer wrote:
>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>> ---
>>>  libavformat/matroskaenc.c | 8 ++++++++
>>>  1 file changed, 8 insertions(+)
>>>
>>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>>> index a48f5bb..d6557a1 100644
>>> --- a/libavformat/matroskaenc.c
>>> +++ b/libavformat/matroskaenc.c
>>> @@ -829,6 +829,14 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre
>>>          par->color_range < AVCOL_RANGE_NB) {
>>>          put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORRANGE, par->color_range);
>>>      }
>>> +    if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED &&
>>> +        par->chroma_location <= AVCHROMA_LOC_TOP) {
>>> +        int xpos, ypos;
>>> +
>>> +        avcodec_enum_to_chroma_pos(&xpos, &ypos, par->chroma_location);
>>> +        put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 7) + 1);
>>> +        put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 7) + 1);
>>> +    }
>>>      if (side_data_size == sizeof(AVMasteringDisplayMetadata)) {
>>>          ebml_master meta_element = start_ebml_master(
>>>              dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0);
>>
>> Ping.
> 
> Ping. Will apply soon if nobody comments.
> 

Applied.
diff mbox

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a48f5bb..d6557a1 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -829,6 +829,14 @@  static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre
         par->color_range < AVCOL_RANGE_NB) {
         put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORRANGE, par->color_range);
     }
+    if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED &&
+        par->chroma_location <= AVCHROMA_LOC_TOP) {
+        int xpos, ypos;
+
+        avcodec_enum_to_chroma_pos(&xpos, &ypos, par->chroma_location);
+        put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 7) + 1);
+        put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 7) + 1);
+    }
     if (side_data_size == sizeof(AVMasteringDisplayMetadata)) {
         ebml_master meta_element = start_ebml_master(
             dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0);