[FFmpeg-devel] Suggestion for a centralized language-tag facility in libavformat

cyril comparon cyril.comparon
Wed Apr 22 11:59:34 CEST 2009


>> >> + ? ?av_strlcpy(searchedEntry.str, lang, 4);
>> >
>> > this and searchedEntry are redundant
>>
>> Since I bsearch over a list of LangEntries, I need to define a
>> LangEntry key and thus copy the searched string into its embedded
>> char[4].
>
> Why do you think you need that?

I am not a C expert but AFAI understand, bsearch requires a key of the
same type as the table's elements. Since that type is "struct {
char[4] code; uint16_t next; }", I have to strcpy the searched
language into an object to be used as a key, don't I?

> also if you have some kind of script that created that table, this may
> be usefull to us too in the future

Sure thing. I wrote it using Qt4. Please find it attached
(iso639tool.cpp, iso639tool.pro, iso639tool.readme).

>> + ? ? ? ? ? ?stream_language_index = asf->streams[i].stream_language_index;
>> + ? ? ? ? ? ?rfc1766 = asf->stream_languages[stream_language_index];
>> + ? ? ? ? ? ?if (rfc1766 && strlen(rfc1766) > 1) {
>
> this is still reading from outside the array

Right.

[...]
>> + ? ? ? ?put_le64(pb, 0); // avg frametime in 100ns units
>> + ? ? ? ?put_le16(pb, 0); //stream-name-count
>> + ? ? ? ?put_le16(pb, 0); //payload-extension-system-count
>
> is it allowed to set all these fields to 0 ?

Actually according to the asf standard, the "stream extension header"
objects are optional. However, they happen to be necessary when
setting language metadata to ensure language-stream matches. In the
attached version of the patch, you will find a new "stream extension
headers" section in the asf muxer code, which was non-existent until
then. I filled that header's fields with values I found acceptable,
however there is of course some of them to be reviewed.

Cyril
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1_avlanguage.patch
Type: application/octet-stream
Size: 27077 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090422/011925b2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2_asf_languages.patch
Type: application/octet-stream
Size: 9479 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090422/011925b2/attachment-0001.obj>



More information about the ffmpeg-devel mailing list