[FFmpeg-devel] [PATCH] avformat/asfenc: write group_mutual_exclusion_objects on multiple languages

Michael Niedermayer michael at niedermayer.cc
Sun Feb 14 03:20:57 CET 2016


On Sun, Feb 07, 2016 at 11:02:56PM +0100, Marton Balint wrote:
> Improves streaming compatibility with Windows Media Services. Also tested for
> compatilbility in Windows Media Player, Windows Media ASF Viewer and VLC.
> 
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavformat/asf.c    |  8 ++++++++
>  libavformat/asf.h    |  2 ++
>  libavformat/asfenc.c | 15 +++++++++++++++
>  3 files changed, 25 insertions(+)
> 
> diff --git a/libavformat/asf.c b/libavformat/asf.c
> index 455ca4d..719cae9 100644
> --- a/libavformat/asf.c
> +++ b/libavformat/asf.c
> @@ -147,6 +147,14 @@ const ff_asf_guid ff_asf_extended_stream_properties_object = {
>      0xcb, 0xa5, 0xe6, 0x14, 0x72, 0xc6, 0x32, 0x43, 0x83, 0x99, 0xa9, 0x69, 0x52, 0x06, 0x5b, 0x5a
>  };
>  
> +const ff_asf_guid ff_asf_group_mutual_exclusion_object = {
> +    0x40, 0x5a, 0x46, 0xd1, 0x79, 0x5a, 0x38, 0x43, 0xb7, 0x1b, 0xe3, 0x6b, 0x8f, 0xd6, 0xc2, 0x49
> +};
> +
> +const ff_asf_guid ff_asf_mutex_language = {
> +    0x00, 0x2a, 0xe2, 0xd6, 0xda, 0x35, 0xd1, 0x11, 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe
> +};
> +
>  /* List of official tags at http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */
>  const AVMetadataConv ff_asf_metadata_conv[] = {
>      { "WM/AlbumArtist",          "album_artist"     },
> diff --git a/libavformat/asf.h b/libavformat/asf.h
> index 914ddef..43288dd 100644
> --- a/libavformat/asf.h
> +++ b/libavformat/asf.h
> @@ -100,6 +100,8 @@ extern const ff_asf_guid ff_asf_content_encryption;
>  extern const ff_asf_guid ff_asf_ext_content_encryption;
>  extern const ff_asf_guid ff_asf_digital_signature;
>  extern const ff_asf_guid ff_asf_extended_stream_properties_object;
> +extern const ff_asf_guid ff_asf_group_mutual_exclusion_object;
> +extern const ff_asf_guid ff_asf_mutex_language;
>  
>  extern const AVMetadataConv ff_asf_metadata_conv[];
>  
> diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
> index a6a8242..3317133 100644
> --- a/libavformat/asfenc.c
> +++ b/libavformat/asfenc.c
> @@ -396,6 +396,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
>      int64_t header_offset, cur_pos, hpos;
>      int bit_rate;
>      int64_t duration;
> +    int language_counts[128] = { 0 };
>  
>      ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
>  
> @@ -447,6 +448,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
>                      asf->streams[n].stream_language_index = asf->nb_languages;
>                      asf->nb_languages++;
>                  }
> +                language_counts[asf->streams[n].stream_language_index]++;
>              }
>          } else {
>              asf->streams[n].stream_language_index = 128;
> @@ -496,6 +498,19 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
>          }
>          end_header(pb, hpos2);
>  
> +        if (asf->nb_languages > 1) {
> +            hpos2 = put_header(pb, &ff_asf_group_mutual_exclusion_object);
> +            ff_put_guid(pb, &ff_asf_mutex_language);
> +            avio_wl16(pb, asf->nb_languages);
> +            for (i = 0; i < asf->nb_languages; i++) {
> +                avio_wl16(pb, language_counts[i]);
> +                for (n = 0; n < s->nb_streams; n++)
> +                    if (asf->streams[n].stream_language_index == i)
> +                        avio_wl16(pb, n + 1);
> +            }
> +            end_header(pb, hpos2);
> +        }

would this make a subtitle and a audio track exclude each other ?
one can want a subtitle ad audio stream of the same language as well
as different languages play at teh same time

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

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160214/a38d097b/attachment.sig>


More information about the ffmpeg-devel mailing list