[FFmpeg-devel] Suggestion for a centralized language-tag facility in libavformat
Michael Niedermayer
michaelni
Fri Apr 24 20:17:50 CEST 2009
On Fri, Apr 24, 2009 at 06:16:36PM +0200, cyril comparon wrote:
> It seems that some files I uploaded are corrupted. Here they are again.
> Cyril
> Changelog | 1
> libavformat/avlanguage.c | 764 +++++++++++++++++++++++++++++++++++++++++++++++
> libavformat/avlanguage.h | 39 ++
> 3 files changed, 804 insertions(+)
> fb7cb1f1442d67e4a29dae881baee9e55caff1d4 /tmp/1_avlanguage-c.patch
already approved
[...]
> @@ -403,6 +405,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];
> + uint8_t lang_len;
> + lang_len = get_byte(pb);
> + get_str16_nolen(pb, lang_len, lang, sizeof(lang));
> + if (j < 128)
> + asf->stream_languages[j] = av_strdup(lang);
> + }
instead of av_strdup() the initial array could be correctly allocated
also this code leaks, if there are 2 ff_asf_language_guids
[...]
> + /* language list */
> + if (nbStreamsWithSupportedLang > 0) {
> + hpos = put_header(pb, &ff_asf_language_guid);
> + put_le16(pb, nbStreamsWithSupportedLang);
> + for(n=0; n<s->nb_streams; n++) {
> + AVMetadataTag *lang_tag = av_metadata_get(s->streams[n]->metadata, "language", NULL, 0);
> + if (lang_tag) {
> + const char *language = av_convertLangTo(lang_tag->value, AV_LANG_ISO639_1);
> + if (language) {
> + put_byte(pb, 2*(1+strlen(language)));
> + put_str16_nolen(pb, language);
> + }
> + }
> + }
> + end_header(pb, hpos);
> + }
trailing whitespace
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- 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/20090424/e9ae47d2/attachment.pgp>
More information about the ffmpeg-devel
mailing list