[FFmpeg-cvslog] avformat/ipmovie: add context to av_log()

Paul B Mahol git at videolan.org
Mon Nov 2 09:03:01 CET 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Nov  2 09:00:53 2015 +0100| [83d20a6a7e8fb4ae31b5336ea06f093f9f5d1e5c] | committer: Paul B Mahol

avformat/ipmovie: add context to av_log()

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=83d20a6a7e8fb4ae31b5336ea06f093f9f5d1e5c
---

 libavformat/ipmovie.c |   76 ++++++++++++++++++++++++-------------------------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index df9b8f0..bc5d8cc 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -119,7 +119,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
 
     if (s->audio_chunk_offset && s->audio_channels && s->audio_bits) {
         if (s->audio_type == AV_CODEC_ID_NONE) {
-            av_log(NULL, AV_LOG_ERROR, "Can not read audio packet before"
+            av_log(s->avf, AV_LOG_ERROR, "Can not read audio packet before"
                    "audio codec is known\n");
                 return CHUNK_BAD;
         }
@@ -147,7 +147,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
             s->audio_frame_count +=
                 (s->audio_chunk_size - 6 - s->audio_channels) / s->audio_channels;
 
-        av_log(NULL, AV_LOG_TRACE, "sending audio frame with pts %"PRId64" (%d audio frames)\n",
+        av_log(s->avf, AV_LOG_TRACE, "sending audio frame with pts %"PRId64" (%d audio frames)\n",
                 pkt->pts, s->audio_frame_count);
 
         chunk_type = CHUNK_VIDEO;
@@ -197,7 +197,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
         pkt->stream_index = s->video_stream_index;
         pkt->pts = s->video_pts;
 
-        av_log(NULL, AV_LOG_TRACE, "sending video frame with pts %"PRId64"\n", pkt->pts);
+        av_log(s->avf, AV_LOG_TRACE, "sending video frame with pts %"PRId64"\n", pkt->pts);
 
         s->video_pts += s->frame_pts_inc;
 
@@ -271,36 +271,36 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
     chunk_size = AV_RL16(&chunk_preamble[0]);
     chunk_type = AV_RL16(&chunk_preamble[2]);
 
-    av_log(NULL, AV_LOG_TRACE, "chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size);
+    av_log(s->avf, AV_LOG_TRACE, "chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size);
 
     switch (chunk_type) {
 
     case CHUNK_INIT_AUDIO:
-        av_log(NULL, AV_LOG_TRACE, "initialize audio\n");
+        av_log(s->avf, AV_LOG_TRACE, "initialize audio\n");
         break;
 
     case CHUNK_AUDIO_ONLY:
-        av_log(NULL, AV_LOG_TRACE, "audio only\n");
+        av_log(s->avf, AV_LOG_TRACE, "audio only\n");
         break;
 
     case CHUNK_INIT_VIDEO:
-        av_log(NULL, AV_LOG_TRACE, "initialize video\n");
+        av_log(s->avf, AV_LOG_TRACE, "initialize video\n");
         break;
 
     case CHUNK_VIDEO:
-        av_log(NULL, AV_LOG_TRACE, "video (and audio)\n");
+        av_log(s->avf, AV_LOG_TRACE, "video (and audio)\n");
         break;
 
     case CHUNK_SHUTDOWN:
-        av_log(NULL, AV_LOG_TRACE, "shutdown\n");
+        av_log(s->avf, AV_LOG_TRACE, "shutdown\n");
         break;
 
     case CHUNK_END:
-        av_log(NULL, AV_LOG_TRACE, "end\n");
+        av_log(s->avf, AV_LOG_TRACE, "end\n");
         break;
 
     default:
-        av_log(NULL, AV_LOG_TRACE, "invalid chunk\n");
+        av_log(s->avf, AV_LOG_TRACE, "invalid chunk\n");
         chunk_type = CHUNK_BAD;
         break;
 
@@ -326,29 +326,29 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
         chunk_size -= OPCODE_PREAMBLE_SIZE;
         chunk_size -= opcode_size;
         if (chunk_size < 0) {
-            av_log(NULL, AV_LOG_TRACE, "chunk_size countdown just went negative\n");
+            av_log(s->avf, AV_LOG_TRACE, "chunk_size countdown just went negative\n");
             chunk_type = CHUNK_BAD;
             break;
         }
 
-        av_log(NULL, AV_LOG_TRACE, "  opcode type %02X, version %d, 0x%04X bytes: ",
+        av_log(s->avf, AV_LOG_TRACE, "  opcode type %02X, version %d, 0x%04X bytes: ",
                 opcode_type, opcode_version, opcode_size);
         switch (opcode_type) {
 
         case OPCODE_END_OF_STREAM:
-            av_log(NULL, AV_LOG_TRACE, "end of stream\n");
+            av_log(s->avf, AV_LOG_TRACE, "end of stream\n");
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_END_OF_CHUNK:
-            av_log(NULL, AV_LOG_TRACE, "end of chunk\n");
+            av_log(s->avf, AV_LOG_TRACE, "end of chunk\n");
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_CREATE_TIMER:
-            av_log(NULL, AV_LOG_TRACE, "create timer\n");
+            av_log(s->avf, AV_LOG_TRACE, "create timer\n");
             if ((opcode_version > 0) || (opcode_size != 6)) {
-                av_log(NULL, AV_LOG_TRACE, "bad create_timer opcode\n");
+                av_log(s->avf, AV_LOG_TRACE, "bad create_timer opcode\n");
                 chunk_type = CHUNK_BAD;
                 break;
             }
@@ -358,15 +358,15 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
                 break;
             }
             s->frame_pts_inc = ((uint64_t)AV_RL32(&scratch[0])) * AV_RL16(&scratch[4]);
-            av_log(NULL, AV_LOG_TRACE, "  %.2f frames/second (timer div = %d, subdiv = %d)\n",
+            av_log(s->avf, AV_LOG_TRACE, "  %.2f frames/second (timer div = %d, subdiv = %d)\n",
                     1000000.0 / s->frame_pts_inc, AV_RL32(&scratch[0]),
                     AV_RL16(&scratch[4]));
             break;
 
         case OPCODE_INIT_AUDIO_BUFFERS:
-            av_log(NULL, AV_LOG_TRACE, "initialize audio buffers\n");
+            av_log(s->avf, AV_LOG_TRACE, "initialize audio buffers\n");
             if (opcode_version > 1 || opcode_size > 10 || opcode_size < 6) {
-                av_log(NULL, AV_LOG_TRACE, "bad init_audio_buffers opcode\n");
+                av_log(s->avf, AV_LOG_TRACE, "bad init_audio_buffers opcode\n");
                 chunk_type = CHUNK_BAD;
                 break;
             }
@@ -388,7 +388,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
                 s->audio_type = AV_CODEC_ID_PCM_S16LE;
             else
                 s->audio_type = AV_CODEC_ID_PCM_U8;
-            av_log(NULL, AV_LOG_TRACE, "audio: %d bits, %d Hz, %s, %s format\n",
+            av_log(s->avf, AV_LOG_TRACE, "audio: %d bits, %d Hz, %s, %s format\n",
                     s->audio_bits, s->audio_sample_rate,
                     (s->audio_channels == 2) ? "stereo" : "mono",
                     (s->audio_type == AV_CODEC_ID_INTERPLAY_DPCM) ?
@@ -396,16 +396,16 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
             break;
 
         case OPCODE_START_STOP_AUDIO:
-            av_log(NULL, AV_LOG_TRACE, "start/stop audio\n");
+            av_log(s->avf, AV_LOG_TRACE, "start/stop audio\n");
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_INIT_VIDEO_BUFFERS:
-            av_log(NULL, AV_LOG_TRACE, "initialize video buffers\n");
+            av_log(s->avf, AV_LOG_TRACE, "initialize video buffers\n");
             if ((opcode_version > 2) || (opcode_size > 8) || opcode_size < 4
                 || opcode_version == 2 && opcode_size < 8
             ) {
-                av_log(NULL, AV_LOG_TRACE, "bad init_video_buffers opcode\n");
+                av_log(s->avf, AV_LOG_TRACE, "bad init_video_buffers opcode\n");
                 chunk_type = CHUNK_BAD;
                 break;
             }
@@ -429,7 +429,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
             } else {
                 s->video_bpp = 16;
             }
-            av_log(NULL, AV_LOG_TRACE, "video resolution: %d x %d\n",
+            av_log(s->avf, AV_LOG_TRACE, "video resolution: %d x %d\n",
                     s->video_width, s->video_height);
             break;
 
@@ -440,17 +440,17 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
         case OPCODE_UNKNOWN_13:
         case OPCODE_UNKNOWN_14:
         case OPCODE_UNKNOWN_15:
-            av_log(NULL, AV_LOG_TRACE, "unknown (but documented) opcode %02X\n", opcode_type);
+            av_log(s->avf, AV_LOG_TRACE, "unknown (but documented) opcode %02X\n", opcode_type);
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_SEND_BUFFER:
-            av_log(NULL, AV_LOG_TRACE, "send buffer\n");
+            av_log(s->avf, AV_LOG_TRACE, "send buffer\n");
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_AUDIO_FRAME:
-            av_log(NULL, AV_LOG_TRACE, "audio frame\n");
+            av_log(s->avf, AV_LOG_TRACE, "audio frame\n");
 
             /* log position and move on for now */
             s->audio_chunk_offset = avio_tell(pb);
@@ -459,26 +459,26 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
             break;
 
         case OPCODE_SILENCE_FRAME:
-            av_log(NULL, AV_LOG_TRACE, "silence frame\n");
+            av_log(s->avf, AV_LOG_TRACE, "silence frame\n");
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_INIT_VIDEO_MODE:
-            av_log(NULL, AV_LOG_TRACE, "initialize video mode\n");
+            av_log(s->avf, AV_LOG_TRACE, "initialize video mode\n");
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_CREATE_GRADIENT:
-            av_log(NULL, AV_LOG_TRACE, "create gradient\n");
+            av_log(s->avf, AV_LOG_TRACE, "create gradient\n");
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_SET_PALETTE:
-            av_log(NULL, AV_LOG_TRACE, "set palette\n");
+            av_log(s->avf, AV_LOG_TRACE, "set palette\n");
             /* check for the logical maximum palette size
              * (3 * 256 + 4 bytes) */
             if (opcode_size > 0x304 || opcode_size < 4) {
-                av_log(NULL, AV_LOG_TRACE, "demux_ipmovie: set_palette opcode with invalid size\n");
+                av_log(s->avf, AV_LOG_TRACE, "demux_ipmovie: set_palette opcode with invalid size\n");
                 chunk_type = CHUNK_BAD;
                 break;
             }
@@ -493,7 +493,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
             /* sanity check (since they are 16 bit values) */
             if (   (first_color > 0xFF) || (last_color > 0xFF)
                 || (last_color - first_color + 1)*3 + 4 > opcode_size) {
-                av_log(NULL, AV_LOG_TRACE, "demux_ipmovie: set_palette indexes out of range (%d -> %d)\n",
+                av_log(s->avf, AV_LOG_TRACE, "demux_ipmovie: set_palette indexes out of range (%d -> %d)\n",
                     first_color, last_color);
                 chunk_type = CHUNK_BAD;
                 break;
@@ -512,12 +512,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
             break;
 
         case OPCODE_SET_PALETTE_COMPRESSED:
-            av_log(NULL, AV_LOG_TRACE, "set palette compressed\n");
+            av_log(s->avf, AV_LOG_TRACE, "set palette compressed\n");
             avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_SET_DECODING_MAP:
-            av_log(NULL, AV_LOG_TRACE, "set decoding map\n");
+            av_log(s->avf, AV_LOG_TRACE, "set decoding map\n");
 
             /* log position and move on for now */
             s->decode_map_chunk_offset = avio_tell(pb);
@@ -526,7 +526,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
             break;
 
         case OPCODE_VIDEO_DATA:
-            av_log(NULL, AV_LOG_TRACE, "set video data\n");
+            av_log(s->avf, AV_LOG_TRACE, "set video data\n");
 
             /* log position and move on for now */
             s->video_chunk_offset = avio_tell(pb);
@@ -535,7 +535,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
             break;
 
         default:
-            av_log(NULL, AV_LOG_TRACE, "*** unknown opcode type\n");
+            av_log(s->avf, AV_LOG_TRACE, "*** unknown opcode type\n");
             chunk_type = CHUNK_BAD;
             break;
 



More information about the ffmpeg-cvslog mailing list