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

Michael Niedermayer michaelni
Tue Apr 28 17:34:42 CEST 2009


On Tue, Apr 28, 2009 at 12:17:40PM +0200, cyril comparon wrote:
> I guess I am getting very impatient with all that so I am letting
> these kind of mistakes.
> This one should be good.

[...]
> @@ -403,6 +407,17 @@
>  //                av_log(s, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate);
>                  asf->stream_bitrates[stream_id]= bitrate;
>              }
> +        } else if (!guidcmp(&g, &ff_asf_language_guid)) {
> +            int j;
> +            int stream_count = get_le16(pb);
> +            for(j = 0; j < stream_count; j++) {
> +                char lang[1024];

6 bytes is enough considering stream_languages isnt larger


> +                uint8_t lang_len;
> +                lang_len = get_byte(pb);

can be merged and id make it a int or unsigned int but thats just me


> +                get_str16_nolen(pb, lang_len, lang, sizeof(lang));
> +                if (j < 128)
> +                    av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages));
> +            }
>          } else if (!guidcmp(&g, &ff_asf_extended_content_header)) {
>              int desc_count, i;
>  

> @@ -443,6 +458,7 @@
>          } else if (!guidcmp(&g, &ff_asf_ext_stream_header)) {
>              int ext_len, payload_ext_ct, stream_ct;
>              uint32_t ext_d, leak_rate, stream_num;
> +            uint16_t streamLanguageIdIndex;

id make that unsigned int too, we dont need a variable of exact size
here


[...]
> +        hpos = put_header(pb, &ff_asf_ext_stream_header);
> +        put_le64(pb, 0); // starttime (optional so zero to ignore it)
> +        put_le64(pb, 0); // endtime (optional so zero to ignore it)
> +        put_le32(pb, s->streams[n]->codec->bit_rate); // leak-datarate
> +        put_le32(pb, BUFFER_SIZE_IN_MS); // bucket-datasize
> +        put_le32(pb, 0); // init-bucket-fullness
> +        put_le32(pb, s->streams[n]->codec->bit_rate); // alt-leak-datarate
> +        put_le32(pb, BUFFER_SIZE_IN_MS); // alt-bucket-datasize in milliseconds

I do not belive you can set these values randomly
I suspect they might be calculatable from the VBV parameters of the streams
and in their absence you will have to analyze all packets their sizes and
timestamps before this can be written

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090428/67f6570c/attachment.pgp>



More information about the ffmpeg-devel mailing list