[vlc-commits] avformat demux: accomodate for Opus lavf extradata

Rafaël Carré git at videolan.org
Mon Jan 27 21:54:33 CET 2014


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Jan 27 21:53:33 2014 +0100| [9003c7c5eb5df0368a18f5798a24d1910e562c96] | committer: Rafaël Carré

avformat demux: accomodate for Opus lavf extradata

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

 modules/demux/avformat/demux.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 40d9e07..ea3907d 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -484,6 +484,32 @@ int OpenDemux( vlc_object_t *p_this )
                     fmt.p_extra = NULL;
                 }
             }
+            else if( cc->codec_id == AV_CODEC_ID_OPUS )
+            {
+                const uint8_t p_dummy_comment[] = {
+                    'O', 'p', 'u', 's',
+                    'T', 'a', 'g', 's',
+                    0, 0, 0, 0, /* Vendor String length */
+                                /* Vendor String */
+                    0, 0, 0, 0, /* User Comment List Length */
+
+                };
+                unsigned pi_size[2];
+                const void *pp_data[2];
+
+                pi_size[0] = i_extra;
+                pp_data[0] = p_extra;
+
+                pi_size[1] = sizeof(p_dummy_comment);
+                pp_data[1] = p_dummy_comment;
+
+                if( pi_size[0] > 0 && xiph_PackHeaders( &fmt.i_extra, &fmt.p_extra,
+                                                        pi_size, pp_data, 2 ) )
+                {
+                    fmt.i_extra = 0;
+                    fmt.p_extra = NULL;
+                }
+            }
             else if( cc->extradata_size > 0 )
             {
                 fmt.p_extra = malloc( i_extra );



More information about the vlc-commits mailing list