[vlc-commits] mux: mp4: add support for wmapro/wfex

Francois Cartegnie git at videolan.org
Tue Oct 27 19:13:53 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 23 16:23:51 2015 +0200| [5e365c18b553f72fe597d9bbb9f227897bb1acc1] | committer: Francois Cartegnie

mux: mp4: add support for wmapro/wfex

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e365c18b553f72fe597d9bbb9f227897bb1acc1
---

 modules/mux/mp4/libmp4mux.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/modules/mux/mp4/libmp4mux.c b/modules/mux/mp4/libmp4mux.c
index cf7a04f..b8b0c26 100644
--- a/modules/mux/mp4/libmp4mux.c
+++ b/modules/mux/mp4/libmp4mux.c
@@ -724,6 +724,27 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt)
     return hvcC;
 }
 
+static bo_t *GetWaveFormatExTag(es_format_t *p_fmt, const char *tag)
+{
+    bo_t *box = box_new(tag);
+    if(!box)
+        return NULL;
+
+    uint16_t wFormatTag;
+    fourcc_to_wf_tag(p_fmt->i_codec, &wFormatTag);
+    bo_add_16le(box, wFormatTag); //wFormatTag
+    bo_add_16le(box, p_fmt->audio.i_channels); //nChannels
+    bo_add_32le(box, p_fmt->audio.i_rate); //nSamplesPerSec
+    bo_add_32le(box, p_fmt->i_bitrate / 8); //nAvgBytesPerSec
+    bo_add_16le(box, p_fmt->audio.i_blockalign); //nBlockAlign
+    bo_add_16le(box, p_fmt->audio.i_bitspersample);  //wBitsPerSample
+    bo_add_16le(box, p_fmt->i_extra); //cbSize
+
+    bo_add_mem(box, p_fmt->i_extra, p_fmt->p_extra);
+
+    return box;
+}
+
 static bo_t *GetxxxxTag(es_format_t *p_fmt, const char *tag)
 {
     bo_t *box = box_new(tag);
@@ -920,6 +941,8 @@ static bo_t *GetSounBox(vlc_object_t *p_obj, mp4mux_trackinfo_t *p_track, bool b
         memcpy(fcc, "ec-3", 4);
     } else if (codec == VLC_CODEC_DTS) {
         memcpy(fcc, "DTS ", 4);
+    } else if (codec == VLC_CODEC_WMAP) {
+        memcpy(fcc, "wma ", 4);
     } else
         vlc_fourcc_to_char(codec, fcc);
 
@@ -969,6 +992,8 @@ static bo_t *GetSounBox(vlc_object_t *p_obj, mp4mux_trackinfo_t *p_track, bool b
             box = GetDac3Tag(p_track->a52_frame);
         else if (codec == VLC_CODEC_EAC3)
             box = GetDec3Tag(&p_track->fmt, p_track->a52_frame);
+        else if (codec == VLC_CODEC_WMAP)
+            box = GetWaveFormatExTag(&p_track->fmt, "wfex");
         else
             box = GetESDS(p_track);
 



More information about the vlc-commits mailing list