Merge remote-tracking branch 'qatar/master'

* qatar/master:
  libavutil: add utility functions to simplify allocation of audio buffers.
  libavutil: add planar sample formats and av_sample_fmt_is_planar()
  avconv: fix segfault at EOF with delayed pictures
  pcmdec: remove unneeded resetting of samples pointer
  avconv: remove a now unused parameter from output_packet().
  avconv: formatting fixes in output_packet()
  avconv: declare some variables in blocks where they are used
  avconv: use the same behavior when decoding audio/video/subs
  bethsoftvideo: return proper consumed size for palette packets.
  cdg: skip packets that don't contain a cdg command.
  crcenc: add flags
  avconv: use vsync 0 for AVFMT_NOTIMESTAMPS formats.
  tiffenc: add a private option for selecting compression algorithm
  md5enc: add flags
  ARM: remove needless .text/.align directives

Conflicts:
	doc/APIchanges
	libavcodec/tiffenc.c
	libavutil/avutil.h
	libavutil/samplefmt.c
	libavutil/samplefmt.h
	tests/ref/fate/bethsoft-vid
	tests/ref/fate/cdgraphics
	tests/ref/fate/film-cvid-pcm-stereo-8bit
	tests/ref/fate/mpeg2-field-enc
	tests/ref/fate/nuv
	tests/ref/fate/tiertex-seq
	tests/ref/fate/tscc-32bit
	tests/ref/fate/vmnc-32bit

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2011-11-24 02:08:21 +01:00
39 changed files with 974 additions and 1264 deletions

View File

@@ -1246,7 +1246,8 @@ static void do_video_out(AVFormatContext *s,
format_video_sync = video_sync_method;
if (format_video_sync < 0)
format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? 2 : 1;
format_video_sync = (s->oformat->flags & AVFMT_NOTIMESTAMPS) ? 0 :
(s->oformat->flags & AVFMT_VARIABLE_FPS) ? 2 : 1;
if (format_video_sync) {
double vdelta = sync_ipts - ost->sync_opts + duration;
@@ -1735,15 +1736,13 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
pkt);
if (ret < 0)
return ret;
pkt->data += ret;
pkt->size -= ret;
*got_output = decoded_data_size > 0;
/* Some bug in mpeg audio decoder gives */
/* decoded_data_size < 0, it seems they are overflows */
if (!*got_output) {
/* no audio frame */
return 0;
return ret;
}
decoded_data_buf = (uint8_t *)samples;
@@ -1816,7 +1815,7 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
do_audio_out(output_files[ost->file_index].ctx, ost, ist,
decoded_data_buf, decoded_data_size);
}
return 0;
return ret;
}
static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *pkt_pts, int64_t *pkt_dts)
@@ -1852,7 +1851,7 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
if (!*got_output) {
/* no picture yet */
av_freep(&decoded_frame);
return 0;
return ret;
}
if(decoded_frame->best_effort_timestamp != AV_NOPTS_VALUE)
@@ -1943,9 +1942,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
if (ret < 0)
return ret;
if (!*got_output)
return 0;
pkt->size = 0;
return ret;
rate_emu_sleep(ist);
@@ -1959,15 +1956,14 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
}
avsubtitle_free(&subtitle);
return 0;
return ret;
}
/* pkt = NULL means EOF (needed to flush decoder buffers) */
static int output_packet(InputStream *ist, int ist_index,
static int output_packet(InputStream *ist,
OutputStream *ost_table, int nb_ostreams,
const AVPacket *pkt)
{
OutputStream *ost;
int ret = 0, i;
int got_output;
int64_t pkt_dts = AV_NOPTS_VALUE;
@@ -1975,8 +1971,8 @@ static int output_packet(InputStream *ist, int ist_index,
AVPacket avpkt;
if(ist->next_pts == AV_NOPTS_VALUE)
ist->next_pts= ist->pts;
if (ist->next_pts == AV_NOPTS_VALUE)
ist->next_pts = ist->pts;
if (pkt == NULL) {
/* EOF handling */
@@ -1999,12 +1995,14 @@ static int output_packet(InputStream *ist, int ist_index,
//while we have more to decode or while the decoder did output something on EOF
while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) {
handle_eof:
ist->pts= ist->next_pts;
if(avpkt.size && avpkt.size != pkt->size)
ist->pts = ist->next_pts;
if (avpkt.size && avpkt.size != pkt->size) {
av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : AV_LOG_WARNING,
"Multiple frames in a packet from stream %d\n", pkt->stream_index);
ist->showed_multi_packet_warning=1;
ist->showed_multi_packet_warning = 1;
}
switch(ist->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
@@ -2022,13 +2020,17 @@ static int output_packet(InputStream *ist, int ist_index,
if (ret < 0)
return ret;
// touch data and size only if not EOF
if (pkt) {
if(ist->st->codec->codec_type != AVMEDIA_TYPE_AUDIO)
ret = avpkt.size;
avpkt.data += ret;
avpkt.size -= ret;
}
if (!got_output) {
if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
continue;
goto discard_packet;
continue;
}
}
discard_packet:
/* handle stream copy */
if (!ist->decoding_needed) {
@@ -2049,7 +2051,7 @@ static int output_packet(InputStream *ist, int ist_index,
}
}
for (i = 0; pkt && i < nb_ostreams; i++) {
ost = &ost_table[i];
OutputStream *ost = &ost_table[i];
if (!check_output_constraints(ist, ost) || ost->encoding_needed)
continue;
@@ -2753,7 +2755,7 @@ static int transcode(OutputFile *output_files, int nb_output_files,
}
//fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->st->index, pkt.size);
if (output_packet(ist, ist_index, output_streams, nb_output_streams, &pkt) < 0) {
if (output_packet(ist, output_streams, nb_output_streams, &pkt) < 0) {
av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n",
ist->file_index, ist->st->index);
@@ -2774,7 +2776,7 @@ static int transcode(OutputFile *output_files, int nb_output_files,
for (i = 0; i < nb_input_streams; i++) {
ist = &input_streams[i];
if (ist->decoding_needed) {
output_packet(ist, i, output_streams, nb_output_streams, NULL);
output_packet(ist, output_streams, nb_output_streams, NULL);
}
}
flush_encoders(output_streams, nb_output_streams);