This patch allows users to be notified about track switch on a continuous audio stream. The A-V statusbar mess up a bit the printing sometimes, I don't know how I should handle that. Also, I wonder if there is an performance issue looping on every metadata that often.
Regards, -- Clément B.
From df4dcd8ba3b3304ce14c78d1e254fd1a07611a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <[email protected]> Date: Thu, 28 Apr 2011 17:00:14 +0200 Subject: [PATCH] ffplay: notify users about audio metadata switch. Users are now notified about track switch on a continuous audio stream. --- ffplay.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/ffplay.c b/ffplay.c index 18010ef..ce272ac 100644 --- a/ffplay.c +++ b/ffplay.c @@ -208,6 +208,8 @@ typedef struct VideoState { char filename[1024]; int width, height, xleft, ytop; + AVMetadata *audio_metadata; ///<metadata for the current audio stream - used to notify track switch in a continuous stream for example + PtsCorrectionContext pts_ctx; #if CONFIG_AVFILTER @@ -2582,6 +2584,27 @@ static int decode_thread(void *arg) (double)(start_time != AV_NOPTS_VALUE ? start_time : 0)/1000000 <= ((double)duration/1000000); if (pkt->stream_index == is->audio_stream && pkt_in_play_range) { + + /* check if audio metadata changed */ + AVMetadata *metadata = ic->streams[pkt->stream_index]->metadata; + + if (is->audio_metadata) { + AVMetadataTag *tag; + + while (tag = av_metadata_get(metadata, "", tag, + AV_METADATA_IGNORE_SUFFIX)) { + AVMetadataTag *oldtag; + + oldtag = av_metadata_get(is->audio_metadata, tag->key, NULL, + AV_METADATA_IGNORE_SUFFIX); + if (!oldtag || strcmp(tag->value, oldtag->value)) + av_log(NULL, AV_LOG_INFO, + "audio metadata: %s changed to %s\n", + tag->key, tag->value); + } + } + av_metadata_copy(&is->audio_metadata, metadata, 0); + packet_queue_put(&is->audioq, pkt); } else if (pkt->stream_index == is->video_stream && pkt_in_play_range) { packet_queue_put(&is->videoq, pkt); -- 1.7.4.4
pgpvpOlaYUqME.pgp
Description: PGP signature
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
