[FFmpeg-devel] [PATCH 2/3] RSD demuxer
Paul B Mahol
onemda at gmail.com
Mon May 6 11:44:08 CEST 2013
On 5/6/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, May 06, 2013 at 11:26:33AM +0200, Michael Niedermayer wrote:
>> On Mon, Apr 22, 2013 at 04:40:42PM -0300, James Almer wrote:
>> >
>> > Signed-off-by: James Almer <jamrial at gmail.com>
>> > ---
>> > Changelog | 1 +
>> > doc/general.texi | 1 +
>> > libavformat/Makefile | 1 +
>> > libavformat/allformats.c | 1 +
>> > libavformat/rsd.c | 193
>> > +++++++++++++++++++++++++++++++++++++++++++++++
>> > libavformat/version.h | 2 +-
>> > 6 files changed, 198 insertions(+), 1 deletion(-)
>> > create mode 100644 libavformat/rsd.c
>> >
[...]
>> > +static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt)
>> > +{
>> > + AVCodecContext *codec = s->streams[0]->codec;
>> > + RSDDemuxContext *rsd = s->priv_data;
>> > + int i, ret, size = 1024;
>> > +
>> > + if (url_feof(s->pb))
>> > + return AVERROR_EOF;
>> > +
>> > + if (codec->codec_id == AV_CODEC_ID_ADPCM_THP) {
>> > + uint8_t *dst;
>> > +
>> > + if ((ret = av_new_packet(pkt, size)) < 0)
>> > + return ret;
>> > + if (!av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
>> > 32))
>> > + return AVERROR(ENOMEM);
>> > + dst = pkt->side_data[0].data;
>> > + for (i = 0; i < 16; i++)
>> > + bytestream_put_be16(&dst, AV_RL16(rsd->table + i * 2));
>>
>> extradata is global data, AV_PKT_DATA_NEW_EXTRADATA is when "global"
>> data changes due to concatenation of 2 streams with different global
>> data.
>> In this case here AVCodecContext->extradata should be used probably
>
> also consider remuxing rsd -> rsd
> If you take the global extradata and put it in every packet then
> the muxer would have to somehow proof that the data never changes
> or risk failure (theres another demuxer where it can change so it
> could get either kind of packets)
>
> and it would have to get the first packet to write the global table
> in the header.
> AVCodecContext.extradata simplifies that alot, the demuxer puts the
> table in extradata, the muxer writes it againa
"Extradata" is different in each packet. So probably different kind of packet
side data should be used.
This code makes it possible to use existing decoder instead of
writting yet another one.
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The educated differ from the uneducated as much as the living from the
> dead. -- Aristotle
>
More information about the ffmpeg-devel
mailing list