Merge remote-tracking branch 'cus/stable'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 27 Jun 2013 00:01:38 +0000 (02:01 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 27 Jun 2013 00:01:44 +0000 (02:01 +0200)
* cus/stable:
  ffplay: simplify and fix flushing out old subtitles on seeking

Merged-by: Michael Niedermayer <michaelni@gmx.at>
doc/bitstream_filters.texi
doc/examples/Makefile
doc/examples/muxing.c
ffprobe.c
libavcodec/utils.c
libavformat/movenc.c
libavformat/mux.c

index 2ee00c134baadf596c0eb75a12f03c6255e79bc2..4f28410ff556353d2cf6ab3105b9eff148f5e799 100644 (file)
@@ -17,8 +17,19 @@ Below is a description of the currently available bitstream filters.
 
 @section aac_adtstoasc
 
+Convert MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration
+bitstream filter.
+
+This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
+ADTS header and removes the ADTS header.
+
+This is required for example when copying an AAC stream from a raw
+ADTS AAC container to a FLV or a MOV/MP4 file.
+
 @section chomp
 
+Remove zero padding at the end of a packet.
+
 @section dump_extradata
 
 @section h264_mp4toannexb
index c849daa6da7cd22450ab25035b08ef8ee0f54297..3a84de8c9b668119ed7d2e50febb297926cc2449 100644 (file)
@@ -7,7 +7,7 @@ FFMPEG_LIBS=    libavdevice                        \
                 libswscale                         \
                 libavutil                          \
 
-CFLAGS += -Wall -O2 -g
+CFLAGS += -Wall -g
 CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
 LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
 
index 303064a82fe3599df791312cc9c48ff9ae7c5768..a8a0edacbed949542158348a6e1dc9a301660875 100644 (file)
@@ -78,7 +78,6 @@ static AVStream *add_stream(AVFormatContext *oc, AVCodec **codec,
 
     switch ((*codec)->type) {
     case AVMEDIA_TYPE_AUDIO:
-        st->id = 1;
         c->sample_fmt  = AV_SAMPLE_FMT_S16;
         c->bit_rate    = 64000;
         c->sample_rate = 44100;
@@ -388,7 +387,7 @@ int main(int argc, char **argv)
     AVFormatContext *oc;
     AVStream *audio_st, *video_st;
     AVCodec *audio_codec, *video_codec;
-    double audio_pts, video_pts;
+    double audio_time, video_time;
     int ret;
 
     /* Initialize libavcodec, and register all codecs and formats. */
@@ -462,21 +461,21 @@ int main(int argc, char **argv)
     for (;;) {
         /* Compute current audio and video time. */
         if (audio_st)
-            audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
+            audio_time = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
         else
-            audio_pts = 0.0;
+            audio_time = 0.0;
 
         if (video_st)
-            video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
+            video_time = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
         else
-            video_pts = 0.0;
+            video_time = 0.0;
 
-        if ((!audio_st || audio_pts >= STREAM_DURATION) &&
-            (!video_st || video_pts >= STREAM_DURATION))
+        if ((!audio_st || audio_time >= STREAM_DURATION) &&
+            (!video_st || video_time >= STREAM_DURATION))
             break;
 
         /* write interleaved audio and video frames */
-        if (!video_st || (video_st && audio_st && audio_pts < video_pts)) {
+        if (!video_st || (video_st && audio_st && audio_time < video_time)) {
             write_audio_frame(oc, audio_st);
         } else {
             write_video_frame(oc, video_st);
index 98c4a4987c1df00a986980740bbf01fed7a79e9f..28c954daaef42080f32ad0ce63f21b905359c0e0 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1904,52 +1904,55 @@ static int probe_file(WriterContext *wctx, const char *filename)
     do_read_packets = do_show_packets || do_count_packets;
 
     ret = open_input_file(&fmt_ctx, filename);
-    if (ret >= 0) {
-        nb_streams_frames  = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_frames));
-        nb_streams_packets = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_packets));
-        selected_streams   = av_calloc(fmt_ctx->nb_streams, sizeof(*selected_streams));
-
-        for (i = 0; i < fmt_ctx->nb_streams; i++) {
-            if (stream_specifier) {
-                ret = avformat_match_stream_specifier(fmt_ctx,
-                                                      fmt_ctx->streams[i],
-                                                      stream_specifier);
-                if (ret < 0)
-                    goto end;
-                else
-                    selected_streams[i] = ret;
-            } else {
-                selected_streams[i] = 1;
-            }
-        }
+    if (ret < 0)
+        return ret;
+
+    nb_streams_frames  = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_frames));
+    nb_streams_packets = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_packets));
+    selected_streams   = av_calloc(fmt_ctx->nb_streams, sizeof(*selected_streams));
 
-        if (do_read_frames || do_read_packets) {
-            if (do_show_frames && do_show_packets &&
-                wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER)
-                section_id = SECTION_ID_PACKETS_AND_FRAMES;
-            else if (do_show_packets && !do_show_frames)
-                section_id = SECTION_ID_PACKETS;
-            else // (!do_show_packets && do_show_frames)
-                section_id = SECTION_ID_FRAMES;
-            if (do_show_frames || do_show_packets)
-                writer_print_section_header(wctx, section_id);
-            read_packets(wctx, fmt_ctx);
-            if (do_show_frames || do_show_packets)
-                writer_print_section_footer(wctx);
+    for (i = 0; i < fmt_ctx->nb_streams; i++) {
+        if (stream_specifier) {
+            ret = avformat_match_stream_specifier(fmt_ctx,
+                                                  fmt_ctx->streams[i],
+                                                  stream_specifier);
+            if (ret < 0)
+                goto end;
+            else
+                selected_streams[i] = ret;
+            ret = 0;
+        } else {
+            selected_streams[i] = 1;
         }
-        if (do_show_streams)
-            show_streams(wctx, fmt_ctx);
-        if (do_show_chapters)
-            show_chapters(wctx, fmt_ctx);
-        if (do_show_format)
-            show_format(wctx, fmt_ctx);
-
-    end:
-        close_input_file(&fmt_ctx);
-        av_freep(&nb_streams_frames);
-        av_freep(&nb_streams_packets);
-        av_freep(&selected_streams);
     }
+
+    if (do_read_frames || do_read_packets) {
+        if (do_show_frames && do_show_packets &&
+            wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER)
+            section_id = SECTION_ID_PACKETS_AND_FRAMES;
+        else if (do_show_packets && !do_show_frames)
+            section_id = SECTION_ID_PACKETS;
+        else // (!do_show_packets && do_show_frames)
+            section_id = SECTION_ID_FRAMES;
+        if (do_show_frames || do_show_packets)
+            writer_print_section_header(wctx, section_id);
+        read_packets(wctx, fmt_ctx);
+        if (do_show_frames || do_show_packets)
+            writer_print_section_footer(wctx);
+    }
+    if (do_show_streams)
+        show_streams(wctx, fmt_ctx);
+    if (do_show_chapters)
+        show_chapters(wctx, fmt_ctx);
+    if (do_show_format)
+        show_format(wctx, fmt_ctx);
+
+end:
+    close_input_file(&fmt_ctx);
+    av_freep(&nb_streams_frames);
+    av_freep(&nb_streams_packets);
+    av_freep(&selected_streams);
+
     return ret;
 }
 
@@ -2356,5 +2359,5 @@ end:
 
     avformat_network_deinit();
 
-    return ret;
+    return ret < 0;
 }
index 97d066f8f92d69796cd71921a226c6a64a7bb020..9fe3a16db73131faaaa1fa7ba8696ac1a4a832dc 100644 (file)
@@ -1395,8 +1395,13 @@ free_and_end:
 
 int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int size)
 {
-    if (size < 0 || avpkt->size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
-        av_log(avctx, AV_LOG_ERROR, "Size %d invalid\n", size);
+    if (avpkt->size < 0) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid negative user packet size %d\n", avpkt->size);
+        return AVERROR(EINVAL);
+    }
+    if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %d (max allowed is %d)\n",
+               size, INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE);
         return AVERROR(EINVAL);
     }
 
index 77fc1804b71489a198ef38cdf4a268f208914cff..cff0760c0e83ea23b21528bf2224efbeb04c0aad 100644 (file)
@@ -3184,7 +3184,9 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
     if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
         (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
         if (!s->streams[pkt->stream_index]->nb_frames) {
-            av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
+            av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: "
+                   "use audio bitstream filter 'aac_adtstoasc' to fix it "
+                   "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
             return -1;
         }
         av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
index bb72a41dcc4e4f4b3fd50f401cc86e1c7c8e152d..82b5a8e2a43c7a5c2190580c25a76c62bb234ccf 100644 (file)
@@ -301,12 +301,12 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
             }
             if (codec->codec_tag) {
                 if (!validate_codec_tag(s, st)) {
-                    char tagbuf[32], cortag[32];
+                    char tagbuf[32], tagbuf2[32];
                     av_get_codec_tag_string(tagbuf, sizeof(tagbuf), codec->codec_tag);
-                    av_get_codec_tag_string(cortag, sizeof(cortag), av_codec_get_tag(s->oformat->codec_tag, codec->codec_id));
+                    av_get_codec_tag_string(tagbuf2, sizeof(tagbuf2), av_codec_get_tag(s->oformat->codec_tag, codec->codec_id));
                     av_log(s, AV_LOG_ERROR,
                            "Tag %s/0x%08x incompatible with output codec id '%d' (%s)\n",
-                           tagbuf, codec->codec_tag, codec->codec_id, cortag);
+                           tagbuf, codec->codec_tag, codec->codec_id, tagbuf2);
                     ret = AVERROR_INVALIDDATA;
                     goto fail;
                 }