[FFmpeg-devel] [RFC] LOAS (aka LATM) demuxer
Martin Storsjö
martin
Tue Aug 3 10:34:18 CEST 2010
On Sun, 1 Aug 2010, Janne Grunau wrote:
> +static int latm_read_audio_mux_element_data(AVFormatContext *s,
> + AVPacket *pkt)
> +{
> + struct latm_demux_context *ctx = s->priv_data;
> + struct latm_stream_config *cfg = &ctx->streams[ctx->cur_stream];
> + int j;
> +
> + if (!ctx->audio_mux_version_A) {
> +
> + pkt->pts = pkt->dts = 2048 * ctx->pkt_cnt;
> + pkt->data = av_malloc(cfg->mux_slot_length);
> + pkt->size = cfg->mux_slot_length;
> + pkt->stream_index = ctx->cur_stream++;
> + //TODO: try to use byte copying
> + for (j = 0; j < cfg->mux_slot_length; j++)
> + pkt->data[j] = get_bits(ctx->gb, 8);
> + //av_hex_dump_log(s, AV_LOG_INFO, pkt->data, pkt->size);
This could use an av_init_packet(), to make sure all other fields are
properly initialized. Also, you need to set pkt->destruct =
av_destruct_packet, otherwise the allocated data will be leaked.
// Martin
More information about the ffmpeg-devel
mailing list