diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-06-04 22:54:15 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-04 22:59:32 +0200 |
commit | 944d049eaa1ca829d97c2877ec9524c049148e14 (patch) | |
tree | 472292bb64fb4b786c5c2bd22835f9bdb0f227b5 /libavformat | |
parent | df03ae8dd80b28e0461611709e290bc61db3cdca (diff) | |
parent | 41e9682af22336bd08a5906629731c0c32aa00c6 (diff) | |
download | ffmpeg-944d049eaa1ca829d97c2877ec9524c049148e14.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
movenc: Write chan atom for all audio tracks in mov mode movies.
mpegtsenc: use avio_open_dyn_buf(), zero pointers after freeing
doc/avconv: add some details about the transcoding process.
avidec: make scale and rate unsigned.
avconv: check output stream recording time before each frame returned from filters
avconv: split selecting input file out of transcode().
avconv: split checking for active outputs out of transcode().
avfiltergraph: make some functions static.
Conflicts:
ffmpeg.c
libavfilter/avfiltergraph.c
libavfilter/internal.h
libavformat/mpegtsenc.c
tests/ref/fate/acodec-alac
tests/ref/fate/acodec-pcm-s16be
tests/ref/fate/acodec-pcm-s24be
tests/ref/fate/acodec-pcm-s32be
tests/ref/fate/acodec-pcm-s8
tests/ref/lavf/mov
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avidec.c | 4 | ||||
-rw-r--r-- | libavformat/movenc.c | 4 | ||||
-rw-r--r-- | libavformat/mpegtsenc.c | 53 |
3 files changed, 12 insertions, 49 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 24aacd04fd..fea069434e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -40,8 +40,8 @@ typedef struct AVIStream { int remaining; int packet_size; - int scale; - int rate; + uint32_t scale; + uint32_t rate; int sample_size; /* size of one sample (or packet) (in the rate/scale sense) in bytes */ int64_t cum_len; /* temporary storage (used during seek) */ diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 54deef4177..fce6bfc7c8 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -422,7 +422,6 @@ static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) } else if (track->enc->codec_id == CODEC_ID_AMR_NB) { mov_write_amr_tag(pb, track); } else if (track->enc->codec_id == CODEC_ID_AC3) { - mov_write_chan_tag(pb, track); mov_write_ac3_tag(pb, track); } else if (track->enc->codec_id == CODEC_ID_ALAC) { mov_write_extradata_tag(pb, track); @@ -695,6 +694,9 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) else if (track->vos_len > 0) mov_write_glbl_tag(pb, track); + if (track->mode == MODE_MOV && track->enc->codec_type == AVMEDIA_TYPE_AUDIO) + mov_write_chan_tag(pb, track); + return update_size(pb, pos); } diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 1df804472c..9e95718a61 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -232,10 +232,6 @@ typedef struct MpegTSWriteStream { int64_t payload_dts; int payload_flags; uint8_t *payload; - - uint8_t *adata; - int adata_pos; - int adata_size; AVFormatContext *amux; } MpegTSWriteStream; @@ -503,19 +499,6 @@ static void section_write_packet(MpegTSSection *s, const uint8_t *packet) avio_write(ctx->pb, packet, TS_PACKET_SIZE); } -/* Write callback for audio packetizer */ -static int mpegts_audio_write(void *opaque, uint8_t *buf, int size) -{ - MpegTSWriteStream *ts_st = (MpegTSWriteStream *)opaque; - if (ts_st->adata_pos + (int64_t)size > ts_st->adata_size) - return AVERROR(EIO); - - memcpy(ts_st->adata + ts_st->adata_pos, buf, size); - ts_st->adata_pos += size; - - return 0; -} - static int mpegts_write_header(AVFormatContext *s) { MpegTSWrite *ts = s->priv_data; @@ -616,25 +599,11 @@ static int mpegts_write_header(AVFormatContext *s) st->codec->extradata_size > 0) { AVStream *ast; - uint8_t *buffer; - int buffer_size = 32768; ts_st->amux = avformat_alloc_context(); if (!ts_st->amux) { ret = AVERROR(ENOMEM); goto fail; } - buffer = av_malloc(buffer_size); - if (!buffer) { - ret = AVERROR(ENOMEM); - goto fail; - } - ts_st->amux->pb = avio_alloc_context(buffer, buffer_size, AVIO_FLAG_WRITE, - ts_st, NULL, mpegts_audio_write, NULL); - if (!ts_st->amux->pb) { - av_free(buffer); - ret = AVERROR(ENOMEM); - goto fail; - } ts_st->amux->oformat = av_guess_format((ts->flags & MPEGTS_FLAG_AAC_LATM) ? "latm" : "adts", NULL, NULL); if (!ts_st->amux->oformat) { ret = AVERROR(EINVAL); @@ -723,8 +692,6 @@ static int mpegts_write_header(AVFormatContext *s) if (ts_st) { av_freep(&ts_st->payload); if (ts_st->amux) { - av_freep(&ts_st->amux->pb->buffer); - av_freep(&ts_st->amux->pb); avformat_free_context(ts_st->amux); ts_st->amux = NULL; } @@ -1130,24 +1097,20 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) av_init_packet(&pkt2); pkt2.data = pkt->data; pkt2.size = pkt->size; - ts_st->adata_size = 1024 + pkt->size; - ts_st->adata = data = av_malloc(ts_st->adata_size); - ts_st->adata_pos = 0; - if (!data) + ret = avio_open_dyn_buf(&ts_st->amux->pb); + if (ret < 0) return AVERROR(ENOMEM); ret = av_write_frame(ts_st->amux, &pkt2); if (ret < 0) { + avio_close_dyn_buf(ts_st->amux->pb, &data); + ts_st->amux->pb = NULL; av_free(data); return ret; } - avio_flush(ts_st->amux->pb); - if (ts_st->amux->pb->error < 0) { - av_free(data); - return ts_st->amux->pb->error; - } - buf = ts_st->adata; - size = ts_st->adata_pos; + size = avio_close_dyn_buf(ts_st->amux->pb, &data); + ts_st->amux->pb = NULL; + buf = data; } } @@ -1236,8 +1199,6 @@ static int mpegts_write_end(AVFormatContext *s) MpegTSWriteStream *ts_st = st->priv_data; av_freep(&ts_st->payload); if (ts_st->amux) { - av_freep(&ts_st->amux->pb->buffer); - av_freep(&ts_st->amux->pb); avformat_free_context(ts_st->amux); ts_st->amux = NULL; } |