[FFmpeg-devel] [PATCH 2/2] ffprobe: print codec timecode if available.
Stefano Sabatini
stefasab at gmail.com
Fri Nov 25 11:21:55 CET 2011
On date Tuesday 2011-11-22 18:02:31 +0100, Clément Bœsch encoded:
> 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.
> 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;
So it will *always* show 00:00:00:00 in case it is not set.
I'm fine with it if you think it makes sense.
--
FFmpeg = Funny Foolish Meaningful Powered Explosive Guru
More information about the ffmpeg-devel
mailing list