]> git.sesse.net Git - vlc/blobdiff - modules/packetizer/h264.c
Use Brackets for global headers.
[vlc] / modules / packetizer / h264.c
index d1f7f882621f45738206c39d0538576737a932da..68351cc3f71dff64db5b8bbed65322a561abda29 100644 (file)
@@ -38,8 +38,8 @@
 #include <vlc_codec.h>
 #include <vlc_block.h>
 
-#include "vlc_block_helper.h"
-#include "vlc_bits.h"
+#include <vlc_block_helper.h>
+#include <vlc_bits.h>
 #include "../codec/cc.h"
 #include "packetizer_helper.h"
 
@@ -183,18 +183,11 @@ static int Open( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     int i;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC( 'h', '2', '6', '4') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'H', '2', '6', '4') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'V', 'S', 'S', 'H') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'v', 's', 's', 'h') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'D', 'A', 'V', 'C') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'x', '2', '6', '4') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'X', '2', '6', '4') &&
-        ( p_dec->fmt_in.i_codec != VLC_FOURCC( 'a', 'v', 'c', '1') ||
-          p_dec->fmt_in.i_extra < 7 ) )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_H264 )
+        return VLC_EGENERIC;
+    if( p_dec->fmt_in.i_original_fourcc == VLC_FOURCC( 'a', 'v', 'c', '1') &&
+        p_dec->fmt_in.i_extra < 7 )
         return VLC_EGENERIC;
-    }
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) ) ) == NULL )
@@ -233,9 +226,9 @@ static int Open( vlc_object_t *p_this )
 
     /* Setup properties */
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
-    p_dec->fmt_out.i_codec = VLC_FOURCC( 'h', '2', '6', '4' );
+    p_dec->fmt_out.i_codec = VLC_CODEC_H264;
 
-    if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'v', 'c', '1' ) )
+    if( p_dec->fmt_in.i_original_fourcc == VLC_FOURCC( 'a', 'v', 'c', '1' ) )
     {
         /* This type of stream is produced by mp4 and matroska
          * when we want to store it in another streamformat, you need to convert
@@ -355,19 +348,8 @@ static int Open( vlc_object_t *p_this )
 
         /* */
         if( p_dec->fmt_in.i_extra > 0 )
-        {
-            block_t *p_init = block_New( p_dec, p_dec->fmt_in.i_extra );
-            block_t *p_pic;
-
-            memcpy( p_init->p_buffer, p_dec->fmt_in.p_extra,
-                    p_dec->fmt_in.i_extra );
-
-            while( ( p_pic = Packetize( p_dec, &p_init ) ) )
-            {
-                /* Should not occur because we should only receive SPS/PPS */
-                block_Release( p_pic );
-            }
-        }
+            packetizer_Header( &p_sys->packetizer,
+                               p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
     }
 
     return VLC_SUCCESS;