[FFmpeg-devel] [RFC] stream parsing
Michael Niedermayer
michaelni
Sun Sep 26 01:17:23 CEST 2010
On Sat, Sep 25, 2010 at 11:17:56PM +0200, Benjamin Larsson wrote:
>
> > looks good to me once reimar agrees too
> >
> > [...]
> >
>
> Patch attached.
>
> https://roundup.ffmpeg.org/issue2137
>
> Before patch:
>
> Input #0, avi, from 'dts2.avi':
> Duration: 00:54:50.59, start: 0.000000, bitrate: 3 kb/s
> Stream #0.0: Video: h264, yuv420p, 1920x800, 23.98 tbr, 23.98 tbn,
> 47.95 tbc
> Stream #0.1: Audio: dca, 48000 Hz, 5 channels, s16, 1509 kb/s
>
>
> Input #0, matroska,webm, from 'fix.mkv':
> Duration: 00:01:00.01, start: 0.000000, bitrate: N/A
> Stream #0.0(eng): Video: h264, yuv420p, 1280x720, PAR 1:1 DAR 16:9,
> 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
> Stream #0.1(eng): Audio: dca, 48000 Hz, 6 channels, s16
>
>
> After patch:
>
> Input #0, avi, from 'dts2.avi':
> Metadata:
> ISFT : VirtualDubMod 1.5.10.1 (Build 2366/Release)
> Duration: 00:54:50.59, start: 0.000000, bitrate: 3 kb/s
> Stream #0.0: Video: h264, yuv420p, 1920x800, 23.98 fps, 23.98 tbr,
> 23.98 tbn, 47.95 tbc
> Stream #0.1: Audio: dca, 48000 Hz, 5.1, s16, 1536 kb/s
>
> Input #0, matroska,webm, from 'fix.mkv':
> Duration: 00:01:00.01, start: 0.000000, bitrate: 768 kb/s
> Stream #0.0(eng): Video: h264, yuv420p, 1280x720, PAR 1:1 DAR 16:9,
> 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
> Stream #0.1(eng): Audio: dca, 48000 Hz, stereo, s16, 768 kb/s
>
>
>
> A few lines above the changes in av_find_stream_info are the same things
> done for AAC only. It should be possible to remove that code and add the
> capability to the codec definition instead. But I leave that to the aac
> codec maintainer for now.
>
> MvH
> Benjamin Larsson
> libavcodec/avcodec.h | 5 +++++
> libavcodec/dca.c | 1 +
> libavformat/utils.c | 9 +++++++++
> 3 files changed, 15 insertions(+)
> 1e4538ccbbb0d79c4bf7b48263454065350fbc76 channel_conf.diff
> Index: libavcodec/avcodec.h
> ===================================================================
> --- libavcodec/avcodec.h (revision 25194)
> +++ libavcodec/avcodec.h (working copy)
> @@ -684,7 +684,12 @@
> * encoders
> */
> #define CODEC_CAP_EXPERIMENTAL 0x0200
> +/**
> + * Codec should fill in channel configuration and samplerate instead of container
> + */
> +#define CODEC_CAP_CHANNEL_CONF 0x0400
>
> +
> //The following defines may change, don't expect compatibility if you use them.
> #define MB_TYPE_INTRA4x4 0x0001
> #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
> Index: libavcodec/dca.c
> ===================================================================
> --- libavcodec/dca.c (revision 25194)
> +++ libavcodec/dca.c (working copy)
> @@ -1500,4 +1500,5 @@
> .decode = dca_decode_frame,
> .close = dca_decode_end,
> .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
> + .capabilities = CODEC_CAP_CHANNEL_CONF,
> };
> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c (revision 25194)
> +++ libavformat/utils.c (working copy)
> @@ -2194,6 +2194,15 @@
> //try to just open decoders, in case this is enough to get parameters
> if(!has_codec_parameters(st->codec)){
> AVCodec *codec = avcodec_find_decoder(st->codec->codec_id);
> +
> + /* Some containers report wrong information about channel configuration
> + * let the codecs handle it in those cases (dca for example)).
> + */
> + if (codec && codec->capabilities & CODEC_CAP_CHANNEL_CONF) {
> + st->codec->sample_rate = 0;
> + st->codec->frame_size = 0;
> + st->codec->channels = 0;
> + }
this looks strange
i would have expected a
if((codec->capabilities & CODEC_CAP_CHANNEL_CONF) && !channel_layout)
return 0;
in has_codec_parameters()
but maybe this doesnt work for some case?
at least your "if we dont have all parameters remove these 3 parameters"
is looking worse
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Always consider everything you type into a computer to be public knowledge.
Everything you do in front a web-cam to be visible to your parents and what
you say in the room of a running computer with a microphone to be as secret
as if you said it in front of a hundred people.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100926/c4be8c29/attachment.pgp>
More information about the ffmpeg-devel
mailing list