On Fri, Apr 29, 2011 at 07:27:26AM +0200, Vladimir Pantelic wrote: > On 04/28/2011 05:10 PM, Ronald S. Bultje wrote: > >Hi, > > > >On Thu, Apr 28, 2011 at 3:05 PM, Clément Bœsch<[email protected]> wrote: > >>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. > > > >Seems like a case where introducing a "metadata_changed" message > >somewhere would help. Maybe in AVPacket.side_data? :-).
This is not really simple to handle when you are in the metadata scope: metadata functions don't have access the AVPacket, it would require a few changes. > > since metadata can change out-of-band, what pkt would you attach it to? > > why not make a simple counter in metadata that increases on each change, > then users don't have to md5sum it to know if it was modified? I tried that, but it would require an API modification, and actually it does not work for a simple reason: the metadata allocation is completely destroyed and a new one is created on track switch. So you might have the same amount of "update count" (which is actually the same value as the count field) while it's total different values. But, the good news is that since it's a different pointer, we can just based the code on this. Of course, this is assuming all other continuous streams demuxers won't add new fields and purges the old ones, but it looks improbable because of the complexity. New simpler patch attached. -- Clément B.
From 52248fbf623c1326a7a62655c58334ef1fe7d027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <[email protected]> Date: Fri, 29 Apr 2011 21:37:06 +0200 Subject: [PATCH] ffplay: notify users about audio metadata switch. Users are now notified about track switch on a continuous audio stream. --- ffplay.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/ffplay.c b/ffplay.c index 73ebc6f..adf6885 100644 --- a/ffplay.c +++ b/ffplay.c @@ -208,6 +208,8 @@ typedef struct VideoState { char filename[1024]; int width, height, xleft, ytop; + AVMetadata *old_audio_meta; ///<used to notify track switch in a continuous audio stream + PtsCorrectionContext pts_ctx; #if CONFIG_AVFILTER @@ -2580,6 +2582,19 @@ 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 *meta = ic->streams[pkt->stream_index]->metadata; + if (meta && is->old_audio_meta && meta != is->old_audio_meta) { + AVMetadataTag *tag = NULL; + av_log(NULL, AV_LOG_INFO, "audio metadata update:\n"); + while (tag = av_metadata_get(meta, "", tag, + AV_METADATA_IGNORE_SUFFIX)) + av_log(NULL, AV_LOG_INFO, " %-16s: %s\n", + tag->key, tag->value); + } + is->old_audio_meta = meta; + 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.5
pgpreQXyJ4JXL.pgp
Description: PGP signature
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
