[FFmpeg-devel,2/4] avformat/mxfdec: set profile for prores codec

Submitted by Paul B Mahol on Dec. 5, 2018, 5:52 p.m.

Details

Message ID 20181205175209.26199-2-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol Dec. 5, 2018, 5:52 p.m.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavformat/mxfdec.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Baptiste Coudurier Dec. 5, 2018, 11:11 p.m.
Hi Paul

On Wed, Dec 5, 2018 at 9:52 AM Paul B Mahol <onemda@gmail.com> wrote:

> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavformat/mxfdec.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index f49890e140..abb030b1a4 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -2432,6 +2432,18 @@ static int mxf_parse_structural_metadata(MXFContext
> *mxf)
>                  default:
>                      av_log(mxf->fc, AV_LOG_INFO, "Unknown frame layout
> type: %d\n", descriptor->frame_layout);
>              }
> +
> +            if (st->codecpar->codec_id == AV_CODEC_ID_PRORES) {
> +                switch (descriptor->essence_codec_ul[14]) {
> +                case 1: st->codecpar->profile = FF_PROFILE_PRORES_PROXY;
>   break;
> +                case 2: st->codecpar->profile = FF_PROFILE_PRORES_LT;
>    break;
> +                case 3: st->codecpar->profile =
> FF_PROFILE_PRORES_STANDARD; break;
> +                case 4: st->codecpar->profile = FF_PROFILE_PRORES_HQ;
>    break;
> +                case 5: st->codecpar->profile = FF_PROFILE_PRORES_4444;
>    break;
> +                case 6: st->codecpar->profile = FF_PROFILE_PRORES_XQ;
>    break;
> +                }
> +            }
> +


 I'm not sure about that, we don't do it for any other codec. IMHO it
should be in the decoder/parser.
Paul B Mahol Dec. 5, 2018, 11:17 p.m.
On 12/6/18, Baptiste Coudurier <baptiste.coudurier@gmail.com> wrote:
> Hi Paul
>
> On Wed, Dec 5, 2018 at 9:52 AM Paul B Mahol <onemda@gmail.com> wrote:
>
>> Signed-off-by: Paul B Mahol <onemda@gmail.com>
>> ---
>>  libavformat/mxfdec.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
>> index f49890e140..abb030b1a4 100644
>> --- a/libavformat/mxfdec.c
>> +++ b/libavformat/mxfdec.c
>> @@ -2432,6 +2432,18 @@ static int mxf_parse_structural_metadata(MXFContext
>> *mxf)
>>                  default:
>>                      av_log(mxf->fc, AV_LOG_INFO, "Unknown frame layout
>> type: %d\n", descriptor->frame_layout);
>>              }
>> +
>> +            if (st->codecpar->codec_id == AV_CODEC_ID_PRORES) {
>> +                switch (descriptor->essence_codec_ul[14]) {
>> +                case 1: st->codecpar->profile = FF_PROFILE_PRORES_PROXY;
>>   break;
>> +                case 2: st->codecpar->profile = FF_PROFILE_PRORES_LT;
>>    break;
>> +                case 3: st->codecpar->profile =
>> FF_PROFILE_PRORES_STANDARD; break;
>> +                case 4: st->codecpar->profile = FF_PROFILE_PRORES_HQ;
>>    break;
>> +                case 5: st->codecpar->profile = FF_PROFILE_PRORES_4444;
>>    break;
>> +                case 6: st->codecpar->profile = FF_PROFILE_PRORES_XQ;
>>    break;
>> +                }
>> +            }
>> +
>
>
>  I'm not sure about that, we don't do it for any other codec. IMHO it
> should be in the decoder/parser.

profile is not stored in bitstream AFAIK so only way it is set is via
demuxer via codec_tag.
MXF does not use codec_tags. So only this way is available.
Baptiste Coudurier Dec. 6, 2018, 6:39 p.m.
On Wed, Dec 5, 2018 at 3:17 PM Paul B Mahol <onemda@gmail.com> wrote:

> On 12/6/18, Baptiste Coudurier <baptiste.coudurier@gmail.com> wrote:
> > Hi Paul
> >
> > On Wed, Dec 5, 2018 at 9:52 AM Paul B Mahol <onemda@gmail.com> wrote:
> >
> >> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> >> ---
> >>  libavformat/mxfdec.c | 12 ++++++++++++
> >>  1 file changed, 12 insertions(+)
> >>
> >> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> >> index f49890e140..abb030b1a4 100644
> >> --- a/libavformat/mxfdec.c
> >> +++ b/libavformat/mxfdec.c
> >> @@ -2432,6 +2432,18 @@ static int
> mxf_parse_structural_metadata(MXFContext
> >> *mxf)
> >>                  default:
> >>                      av_log(mxf->fc, AV_LOG_INFO, "Unknown frame layout
> >> type: %d\n", descriptor->frame_layout);
> >>              }
> >> +
> >> +            if (st->codecpar->codec_id == AV_CODEC_ID_PRORES) {
> >> +                switch (descriptor->essence_codec_ul[14]) {
> >> +                case 1: st->codecpar->profile =
> FF_PROFILE_PRORES_PROXY;
> >>   break;
> >> +                case 2: st->codecpar->profile = FF_PROFILE_PRORES_LT;
> >>    break;
> >> +                case 3: st->codecpar->profile =
> >> FF_PROFILE_PRORES_STANDARD; break;
> >> +                case 4: st->codecpar->profile = FF_PROFILE_PRORES_HQ;
> >>    break;
> >> +                case 5: st->codecpar->profile = FF_PROFILE_PRORES_4444;
> >>    break;
> >> +                case 6: st->codecpar->profile = FF_PROFILE_PRORES_XQ;
> >>    break;
> >> +                }
> >> +            }
> >> +
> >
> >
> >  I'm not sure about that, we don't do it for any other codec. IMHO it
> > should be in the decoder/parser.
>
> profile is not stored in bitstream AFAIK so only way it is set is via
> demuxer via codec_tag.
> MXF does not use codec_tags. So only this way is available.
>

Seems like decoder sets it from MOV fourcc, so I think it should be fine.

Patch hide | download patch | download mbox

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index f49890e140..abb030b1a4 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2432,6 +2432,18 @@  static int mxf_parse_structural_metadata(MXFContext *mxf)
                 default:
                     av_log(mxf->fc, AV_LOG_INFO, "Unknown frame layout type: %d\n", descriptor->frame_layout);
             }
+
+            if (st->codecpar->codec_id == AV_CODEC_ID_PRORES) {
+                switch (descriptor->essence_codec_ul[14]) {
+                case 1: st->codecpar->profile = FF_PROFILE_PRORES_PROXY;    break;
+                case 2: st->codecpar->profile = FF_PROFILE_PRORES_LT;       break;
+                case 3: st->codecpar->profile = FF_PROFILE_PRORES_STANDARD; break;
+                case 4: st->codecpar->profile = FF_PROFILE_PRORES_HQ;       break;
+                case 5: st->codecpar->profile = FF_PROFILE_PRORES_4444;     break;
+                case 6: st->codecpar->profile = FF_PROFILE_PRORES_XQ;       break;
+                }
+            }
+
             if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
                 st->codecpar->format = descriptor->pix_fmt;
                 if (st->codecpar->format == AV_PIX_FMT_NONE) {