Browse code

mpegts: Wrap #ifdef DEBUG and av_hex_dump_log() combination in a macro.

Diego Biurrun authored on 2011/05/28 03:34:01
Showing 2 changed files
... ...
@@ -26,6 +26,12 @@
26 26
 
27 27
 #define MAX_URL_SIZE 4096
28 28
 
29
+#ifdef DEBUG
30
+#    define hex_dump_debug(class, buf, size) av_hex_dump_log(class, AV_LOG_DEBUG, buf, size)
31
+#else
32
+#    define hex_dump_debug(class, buf, size)
33
+#endif
34
+
29 35
 typedef struct AVCodecTag {
30 36
     enum CodecID id;
31 37
     unsigned int tag;
... ...
@@ -1014,10 +1014,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
1014 1014
     int mp4_dec_config_descr_len = 0;
1015 1015
     int mp4_es_id = 0;
1016 1016
 
1017
-#ifdef DEBUG
1018 1017
     av_dlog(ts->stream, "PMT: len %i\n", section_len);
1019
-    av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
1020
-#endif
1018
+    hex_dump_debug(ts->stream, (uint8_t *)section, section_len);
1021 1019
 
1022 1020
     p_end = section + section_len - 4;
1023 1021
     p = section;
... ...
@@ -1134,10 +1132,9 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
1134 1134
     const uint8_t *p, *p_end;
1135 1135
     int sid, pmt_pid;
1136 1136
 
1137
-#ifdef DEBUG
1138 1137
     av_dlog(ts->stream, "PAT:\n");
1139
-    av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
1140
-#endif
1138
+    hex_dump_debug(ts->stream, (uint8_t *)section, section_len);
1139
+
1141 1140
     p_end = section + section_len - 4;
1142 1141
     p = section;
1143 1142
     if (parse_section_header(h, &p, p_end) < 0)
... ...
@@ -1178,10 +1175,8 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
1178 1178
     int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type;
1179 1179
     char *name, *provider_name;
1180 1180
 
1181
-#ifdef DEBUG
1182 1181
     av_dlog(ts->stream, "SDT:\n");
1183
-    av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
1184
-#endif
1182
+    hex_dump_debug(ts->stream, (uint8_t *)section, section_len);
1185 1183
 
1186 1184
     p_end = section + section_len - 4;
1187 1185
     p = section;