mpegts: factorize pes packet state reset function
authorMarton Balint <cus@passwd.hu>
Fri, 2 May 2014 14:51:58 +0000 (16:51 +0200)
committerMarton Balint <cus@passwd.hu>
Mon, 5 May 2014 20:33:52 +0000 (22:33 +0200)
Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/mpegts.c

index 75553b6..1bd697a 100644 (file)
@@ -787,6 +787,15 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
     return 0;
 }
 
+static void reset_pes_packet_state(PESContext *pes)
+{
+    pes->pts        = AV_NOPTS_VALUE;
+    pes->dts        = AV_NOPTS_VALUE;
+    pes->buffer     = NULL;
+    pes->data_index = 0;
+    pes->flags      = 0;
+}
+
 static void new_pes_packet(PESContext *pes, AVPacket *pkt)
 {
     av_init_packet(pkt);
@@ -814,12 +823,7 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
     pkt->pos   = pes->ts_packet_pos;
     pkt->flags = pes->flags;
 
-    /* reset pts values */
-    pes->pts        = AV_NOPTS_VALUE;
-    pes->dts        = AV_NOPTS_VALUE;
-    pes->buffer     = NULL;
-    pes->data_index = 0;
-    pes->flags      = 0;
+    reset_pes_packet_state(pes);
 }
 
 static uint64_t get_ts64(GetBitContext *gb, int bits)