]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
global headers: create own AAC/MP4A header only if a valid does not exist
authorJaroslav Kysela <perex@perex.cz>
Fri, 17 Oct 2014 07:11:47 +0000 (09:11 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 17 Oct 2014 07:11:47 +0000 (09:11 +0200)
src/plumbing/globalheaders.c

index 371468d2ca5cbb7ef0d171024267c3ba5c82b1f7..5571a0194c0bfadb1b47148f304cd23a660e475d 100644 (file)
@@ -59,7 +59,6 @@ gh_flush(globalheaders_t *gh)
 static void
 apply_header(streaming_start_component_t *ssc, th_pkt_t *pkt)
 {
-  uint8_t *d;
   if(ssc->ssc_frameduration == 0 && pkt->pkt_duration != 0)
     ssc->ssc_frameduration = pkt->pkt_duration;
 
@@ -78,26 +77,19 @@ apply_header(streaming_start_component_t *ssc, th_pkt_t *pkt)
   if(ssc->ssc_gh != NULL)
     return;
 
-  switch(ssc->ssc_type) {
-  case SCT_MP4A:
-  case SCT_AAC:
+  if(pkt->pkt_header != NULL) {
+    ssc->ssc_gh = pkt->pkt_header;
+    pktbuf_ref_inc(ssc->ssc_gh);
+    return;
+  }
+
+  if (ssc->ssc_type == SCT_MP4A || ssc->ssc_type == SCT_AAC) {
     ssc->ssc_gh = pktbuf_alloc(NULL, 2);
-    d = pktbuf_ptr(ssc->ssc_gh);
+    uint8_t *d = pktbuf_ptr(ssc->ssc_gh);
 
     const int profile = 2;
     d[0] = (profile << 3) | ((pkt->pkt_sri & 0xe) >> 1);
     d[1] = ((pkt->pkt_sri & 0x1) << 7) | (pkt->pkt_channels << 3);
-    break;
-
-  case SCT_H264:
-  case SCT_MPEG2VIDEO:
-  case SCT_VORBIS:
-
-    if(pkt->pkt_header != NULL) {
-      ssc->ssc_gh = pkt->pkt_header;
-      pktbuf_ref_inc(ssc->ssc_gh);
-    }
-    break;
   }
 }