[FFmpeg-devel] [PATCH 2/2] ffprobe: print codec timecode if available.

Clément Bœsch ubitux at gmail.com
Tue Nov 22 18:02:31 CET 2011


On Thu, Nov 17, 2011 at 01:30:13AM +0100, Stefano Sabatini wrote:
> On date Wednesday 2011-11-16 17:52:34 +0100, Clément Bœsch encoded:
> > From: Clément Bœsch <clement.boesch at smartjog.com>
> > 
> > ---
> >  ffprobe.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/ffprobe.c b/ffprobe.c
> > index c15cf7b..70198a6 100644
> > --- a/ffprobe.c
> > +++ b/ffprobe.c
> > @@ -977,6 +977,8 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
> >              if (s) print_str    ("pix_fmt", s);
> >              else   print_str_opt("pix_fmt", "unknown");
> >              print_int("level",   dec_ctx->level);
> > +            if (dec_ctx->timecode_str[0])
> > +                print_str("timecode", dec_ctx->timecode_str);
> 
> else print_str_opt("N\A");
> 
> It should be printed anyway in compact/default (possible problem:
> timecode_str[] may assume the value "N/A").

The new attached version will display it all the time.

-- 
Clément B.
-------------- next part --------------
From b8df0e43e7cda142cab2483ebd433c4dd9c88ebb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <clement.boesch at smartjog.com>
Date: Wed, 16 Nov 2011 17:42:48 +0100
Subject: [PATCH 2/2] ffprobe: print codec timecode if available.

---
 ffprobe.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index 52f07e7..f529fd1 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -951,6 +951,7 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
     print_int("index", stream->index);
 
     if ((dec_ctx = stream->codec)) {
+        uint32_t tc;
         if ((dec = dec_ctx->codec)) {
             print_str("codec_name",      dec->name);
             print_str("codec_long_name", dec->long_name);
@@ -993,6 +994,13 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
             if (s) print_str    ("pix_fmt", s);
             else   print_str_opt("pix_fmt", "unknown");
             print_int("level",   dec_ctx->level);
+            tc = (uint32_t)dec_ctx->timecode_frame_start;
+            print_fmt("timecode", "%02d:%02d:%02d%c%02d",
+                      tc>>19 & 0x1f,              // hours
+                      tc>>13 & 0x3f,              // minutes
+                      tc>>6  & 0x3f,              // seconds
+                      tc     & 1<<24 ? ';' : ':', // drop
+                      tc     & 0x3f);             // frames
             break;
 
         case AVMEDIA_TYPE_AUDIO:
-- 
1.7.7.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111122/f8b806e2/attachment.asc>


More information about the ffmpeg-devel mailing list