]> granicus.if.org Git - handbrake/commitdiff
- minor code cleanup - use x264_nal_t.i_type instead of buffer+offset&mask.
authorkonablend <kona8lend@gmail.com>
Sun, 3 May 2009 21:53:37 +0000 (21:53 +0000)
committerkonablend <kona8lend@gmail.com>
Sun, 3 May 2009 21:53:37 +0000 (21:53 +0000)
- use constants instead of hardcoded values.
- explicitly list expected nal types to be processed further.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2372 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/encx264.c

index 374c921842f5b06bc8356da1b1688a2e273abd1c..d00479468744627a9ecfa3c1d075434edb798b70 100644 (file)
@@ -448,12 +448,20 @@ static hb_buffer_t *nal_encode( hb_work_object_t *w, x264_picture_t *pic_out,
         }
 
         /* H.264 in .mp4 or .mkv */
-        int naltype = buf->data[buf->size+4] & 0x1f;
-        if ( naltype == 0x7 || naltype == 0x8 )
+        switch( nal[i].i_type )
         {
-            // Sequence Parameter Set & Program Parameter Set go in the
-            // mp4 header so skip them here
-            continue;
+            /* Sequence Parameter Set & Program Parameter Set go in the
+             * mp4 header so skip them here
+             */
+            case NAL_SPS:
+            case NAL_PPS:
+                continue;
+
+            case NAL_SLICE:
+            case NAL_SLICE_IDR:
+            case NAL_SEI:
+            default:
+                break;
         }
 
         /* H.264 in mp4 (stolen from mp4creator) */