Hi,

On Fri, Jan 6, 2012 at 2:31 PM, Paul B Mahol <[email protected]> wrote:
> On 1/6/12, Ronald S. Bultje <[email protected]> wrote:
>> On Fri, Jan 6, 2012 at 1:19 PM, Paul B Mahol <[email protected]> wrote:
>>> On 1/6/12, Ronald S. Bultje <[email protected]> wrote:
>>>> On Fri, Jan 6, 2012 at 12:00 PM, Paul B Mahol <[email protected]> wrote:
>>>>> On 1/6/12, Ronald S. Bultje <[email protected]> wrote:
>>>>>> On Fri, Jan 6, 2012 at 10:08 AM, Paul B Mahol <[email protected]> wrote:
>>>>>>> On 1/6/12, Paul B Mahol <[email protected]> wrote:
>>>>>>>> On 1/6/12, Ronald S. Bultje <[email protected]> wrote:
>>>>>>>>> On Fri, Jan 6, 2012 at 9:18 AM, Paul B Mahol <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>> ---
>>>>>>>>>>  libavformat/vqf.c |   42
>>>>>>>>>> ++++++++++++++++++++++++++++++++++++++++++
>>>>>>>>>>  1 files changed, 42 insertions(+), 0 deletions(-)
>>>>>>>>>>
>>>>>>>>>> diff --git a/libavformat/vqf.c b/libavformat/vqf.c
>>>>>>>>>> index 3e79299..608ecbd 100644
>>>>>>>>>> --- a/libavformat/vqf.c
>>>>>>>>>> +++ b/libavformat/vqf.c
>>>>>>>>>> @@ -140,6 +140,48 @@ static int vqf_read_header(AVFormatContext *s,
>>>>>>>>>> AVFormatParameters *ap)
>>>>>>>>>>         case MKTAG('G','E','N','R'):
>>>>>>>>>>             add_metadata(s, "genre"    , len, header_size);
>>>>>>>>>>             break;
>>>>>>>>>> +        case MKTAG('L','Y','R','C'):
>>>>>>>>>> +            add_metadata(s, "lyrics"   , len, header_size);
>>>>>>>>>> +            break;
>>>>>>>>>> +        case MKTAG('G','U','I','D'):
>>>>>>>>>> +            add_metadata(s, "GUID"     , len, header_size);
>>>>>>>>>> +            break;
>>>>>>>>>> +        case MKTAG('I','S','R','C'):
>>>>>>>>>> +            add_metadata(s, "ISRC"     , len, header_size);
>>>>>>>>>> +            break;
>>>>>>>>>
>>>>>>>>> I'm probably being a pain, but wouldn't a nice loop over a table
>>>>>>>>> matching fourcc-tag to metadata-string-tag lead to much less code?
>>>>>>>>
>>>>>>>> Probably, patch on hold.
>>>>>>>>
>>>>>>>
>>>>>>> This would need more work with no much gain IMHO.
>>>>>>
>>>>>> Not that much work:
>>>>>>
>>>>>> static const struct {
>>>>>>     uint32_t fcc;
>>>>>>     char *str;
>>>>>> } meta_conv_table[] = {
>>>>>>     { MKTAG(...), "..." },
>>>>>>     ..,
>>>>>>     { 0, NULL },
>>>>>> };
>>>>>
>>>>> What about using AVMetadataConv from riff.h?
>>>>
>>>> It's string-string vs. fourcc-string, so you'll need to convert from a
>>>> fcc to a string. I'm fine with it if you prefer that.
>>>>
>>>> Another option is to add my new fcc/string conversion utility
>>>> function/struct to metadata.h. Choose whichever you prefer.
>>>
>>> I more interested in adding tags as they are and then let known tags
>>> get converted
>>> like in avi demuxer.
>>> Non-converted tags (chunks which may be not be tags at all) would be
>>> still displayed. Currenty they are all ignored.
>>
>> for (n = 0; meta_conv_table[n].fcc != 0; n++) {
>>     if (meta_conv_table[n].fcc == switch_fcc) {
>>         set_metadata(meta_conv_table[n].str, ...);
>>         break;
>>     }
>> }
>> if (!meta_conv_table[n].fcc) {
>>     char str[5];
>>     AV_WL32(&str, switch_fcc);
>>     str[4] = 0;
>>     set_metadata(str, ...);
>> }
>>
>
> Can I use ff_metadata_conv_ctx() ?

Hehe, of course. :-).

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to