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

Rafaël Carré git at videolan.org
Mon Jan 27 22:00:11 CET 2014


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

avformat demux: accomodate for Opus lavf extradata

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

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

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 40d9e07..6e8086e 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -484,6 +484,34 @@ int OpenDemux( vlc_object_t *p_this )
                     fmt.p_extra = NULL;
                 }
             }
+#if LIBAVCODEC_VERSION_CHECK( 54, 29, 0, 17, 101 )
+            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;
+                }
+            }
+#endif
             else if( cc->extradata_size > 0 )
             {
                 fmt.p_extra = malloc( i_extra );



More information about the vlc-commits mailing list