[soc]: r4387 - als/ffmpeg-patches/hack4als.patch
Author: thilo.borgmann Date: Fri Jun 5 13:06:54 2009 New Revision: 4387 Log: Adds a patch for the FFmpeg trunk to enable ALS demuxing. This patch has been written by Jai Menon but has not passed review yet. Refer to thread "[PATCH] als in mp4" for details. This patch is not meant to be applied as-is in the end but enables me to continue work on the ALS decoder for the time being. If necessary, I will continue to work on this patch to pass the review process if it has not been done as soon as the ALS decoder is to be applied to the codebase. Added: als/ffmpeg-patches/hack4als.patch Added: als/ffmpeg-patches/hack4als.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ als/ffmpeg-patches/hack4als.patch Fri Jun 5 13:06:54 2009 (r4387) @@ -0,0 +1,65 @@ +Index: libavcodec/mpeg4audio.c +=================================================================== +--- libavcodec/mpeg4audio.c (Revision 19089) ++++ libavcodec/mpeg4audio.c (Arbeitskopie) +@@ -57,6 +57,8 @@ + c->object_type = get_object_type(&gb); + c->sample_rate = get_sample_rate(&gb, &c->sampling_index); + c->chan_config = get_bits(&gb, 4); ++ c->absolute_channels = 0; ++ c->bits_per_sample = 0; + c->sbr = -1; + if (c->object_type == 5) { + c->ext_object_type = c->object_type; +@@ -84,6 +86,12 @@ + get_bits1(&gb); // skip 1 bit + } + } ++ if (c->object_type == AOT_ALS) { ++ c->absolute_channels = 1; ++ c->sample_rate = AV_RB32(buf + 10); ++ c->chan_config = AV_RB16(buf + 18) + 1; ++ c->bits_per_sample = (((buf[20] >> 2) & 0x07) + 1) << 3; ++ } + return specific_config_bitindex; + } + +Index: libavcodec/mpeg4audio.h +=================================================================== +--- libavcodec/mpeg4audio.h (Revision 19089) ++++ libavcodec/mpeg4audio.h (Arbeitskopie) +@@ -36,6 +36,8 @@ + int ext_sampling_index; + int ext_sample_rate; + int ext_chan_config; ++ int bits_per_sample; ++ int absolute_channels; + } MPEG4AudioConfig; + + extern const int ff_mpeg4audio_sample_rates[16]; +Index: libavformat/mov.c +=================================================================== +--- libavformat/mov.c (Revision 19089) ++++ libavformat/mov.c (Arbeitskopie) +@@ -425,13 +425,18 @@ + MPEG4AudioConfig cfg; + ff_mpeg4audio_get_config(&cfg, st->codec->extradata, + st->codec->extradata_size); +- if (cfg.chan_config > 7) +- return -1; +- st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config]; ++ if (!cfg.absolute_channels) { ++ if (cfg.chan_config > 7) ++ return -1; ++ st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config]; ++ } else st->codec->channels = cfg.chan_config; ++ + if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4 + st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index]; + else + st->codec->sample_rate = cfg.sample_rate; // ext sample rate ? ++ if (cfg.bits_per_sample) ++ st->codec->bits_per_coded_sample = cfg.bits_per_sample; + dprintf(c->fc, "mp4a config channels %d obj %d ext obj %d " + "sample rate %d ext sample rate %d\n", st->codec->channels, + cfg.object_type, cfg.ext_object_type,
On Fri, Jun 5, 2009 at 4:36 PM, thilo.borgmann<subversion@mplayerhq.hu> wrote:
Author: thilo.borgmann Date: Fri Jun 5 13:06:54 2009 New Revision: 4387
Log: Adds a patch for the FFmpeg trunk to enable ALS demuxing.
This patch has been written by Jai Menon but has not passed review yet. Refer to thread "[PATCH] als in mp4" for details.
This patch is not meant to be applied as-is in the end but enables me to continue work on the ALS decoder for the time being.
To reiterate, you don't _need_ this patch to proceed, the ALS decoder should parse the no. of channels from extradata and set channels parameter correctly. Yes, it should be done on the container side and I'll try and get this in soon. But this is never going to block your work in any way. -- Regards, Jai
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
To reiterate, you don't _need_ this patch to proceed, the ALS decoder should parse the no. of channels from extradata and set channels parameter correctly. Yes, it should be done on the container side and I'll try and get this in soon. But this is never going to block your work in any way.
Without it I can't let ffplay demux the files and pass the frames to the decoder. It would fail opening the SDL audio device. Therefore, it is needed if I do want to write the decoder and test its features. Isn't it? Thilo -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFKKQIWQjO++GdR9a4RAv01AKCdYIgiKHt+Mr6MIDUQYWLdLrkHBACgjESZ /zDWD10uOjbsPzB1JPge454= =33NX -----END PGP SIGNATURE-----
Thilo Borgmann wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
To reiterate, you don't _need_ this patch to proceed, the ALS decoder should parse the no. of channels from extradata and set channels parameter correctly. Yes, it should be done on the container side and I'll try and get this in soon. But this is never going to block your work in any way.
Without it I can't let ffplay demux the files and pass the frames to the decoder. It would fail opening the SDL audio device.
Therefore, it is needed if I do want to write the decoder and test its features. Isn't it?
Well, not specifically required. I did not look at the patch carefully enough. This is needed for stream copy and would be good to have in the demuxer, but is not required for the decoder. As long as ALS is identified in the demuxer and the proper extradata is set, the init function in the ALS decoder should read from the ALSSpecificConfig in the extradata to set the audio parameters. -Justin
On Fri, Jun 5, 2009 at 11:31 AM, Thilo Borgmann<thilo.borgmann@googlemail.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
To reiterate, you don't _need_ this patch to proceed, the ALS decoder should parse the no. of channels from extradata and set channels parameter correctly. Yes, it should be done on the container side and I'll try and get this in soon. But this is never going to block your work in any way.
Without it I can't let ffplay demux the files and pass the frames to the decoder. It would fail opening the SDL audio device.
I dunno much but av_find_stream_info tries to decode a few frames and get the necessary parameters, following which the audio output is opened in stream_component_open. So it should work. If it doesn't, then its probably a bug and in which case we should investigate further.
Therefore, it is needed if I do want to write the decoder and test its features. Isn't it?
And its a lossless codec right? So why not write a script which runs through the als test vectors and does a comparison with the reference waveform. This is very useful for regressions also. You need not "enable" all the test vectors for now, just the subtools/features you are implementing initially. Anyway, this is just a sidenote :) -- Regards, Jai
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I dunno much but av_find_stream_info tries to decode a few frames and get the necessary parameters, following which the audio output is opened in stream_component_open. So it should work. If it doesn't, then its probably a bug and in which case we should investigate further.
All my fault. I missed that the decoders init function is called to get these parameters before the described error occurs in ffplay. Your patch extract these information and therefore it seemed to be necessary in my eyes to get this going in ffplay. Justin suggests a function for reading basic parameters which shall be shared by libavformat/libavcodec to avoid redundancy. I will try to implement this soon to replace this hack4als.patch and let the decoders init function do this work then.
Therefore, it is needed if I do want to write the decoder and test its features. Isn't it?
And its a lossless codec right? So why not write a script which runs through the als test vectors and does a comparison with the reference waveform. This is very useful for regressions also. You need not "enable" all the test vectors for now, just the subtools/features you are implementing initially. Anyway, this is just a sidenote :)
Sounds interesting. I will have a look at this - thanks! Thilo -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFKKq7bQjO++GdR9a4RAnFUAKCEca02M2e5yehxvtEf6Azomm1rFQCdH0ZR OpPsscCBPuChB1aYW85BxgA= =3fHK -----END PGP SIGNATURE-----
participants (4)
-
Jai Menon -
Justin Ruggles -
Thilo Borgmann -
thilo.borgmann