summaryrefslogtreecommitdiff
path: root/avconv.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-11-21 15:37:40 +0100
committerAnton Khirnov <anton@khirnov.net>2011-11-21 21:43:48 +0100
commit82963f8f046bbe724e6c770a2aaf0290c9915503 (patch)
treed59fbf4d587111cc4f9dd920731e0448780d6ea5 /avconv.c
parent9595234c941cb81ffc2858e3f5859f0b9fa58a39 (diff)
avconv: cleanup the transcoding loop in output_packet().
Diffstat (limited to 'avconv.c')
-rw-r--r--avconv.c59
1 files changed, 14 insertions, 45 deletions
diff --git a/avconv.c b/avconv.c
index 4a5fb9c0bb..a87f852444 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1878,58 +1878,27 @@ static int output_packet(InputStream *ist, int ist_index,
"Multiple frames in a packet from stream %d\n", pkt->stream_index);
ist->showed_multi_packet_warning=1;
- // XXX temporary hack, will be turned to a switch() once all codec
- // types are split out
- if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- ret = transcode_audio(ist, &avpkt, &got_output);
- if (ret < 0)
- return ret;
- continue;
- } else if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- ret = transcode_video(ist, &avpkt, &got_output, &pkt_pts);
- if (ret < 0)
- return ret;
- if (!got_output)
- goto discard_packet;
- continue;
- } else if (ist->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
- ret = transcode_subtitles(ist, &avpkt, &got_output);
- if (ret < 0)
- return ret;
- if (!got_output)
- goto discard_packet;
- continue;
- }
-
- /* decode the packet if needed */
switch(ist->st->codec->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ ret = transcode_audio (ist, &avpkt, &got_output);
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ ret = transcode_video (ist, &avpkt, &got_output, &pkt_pts);
+ break;
+ case AVMEDIA_TYPE_SUBTITLE:
+ ret = transcode_subtitles(ist, &avpkt, &got_output);
+ break;
default:
return -1;
}
- /* frame rate emulation */
- rate_emu_sleep(ist);
-
- /* if output time reached then transcode raw format,
- encode packets and output them */
- for (i = 0; i < nb_ostreams; i++) {
- ost = &ost_table[i];
-
- if (!check_output_constraints(ist, ost) || !ost->encoding_needed)
- continue;
-
- /* set the input output pts pairs */
- //ost->sync_ipts = (double)(ist->pts + input_files[ist->file_index].ts_offset - start_time)/ AV_TIME_BASE;
-
- av_assert0(ist->decoding_needed);
- switch(ost->st->codec->codec_type) {
- default:
- abort();
- }
- }
-
if (ret < 0)
return ret;
+ if (!got_output) {
+ if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
+ continue;
+ goto discard_packet;
+ }
}
discard_packet: