Browse code

Merge remote-tracking branch 'qatar/master'

* qatar/master:
opt: Add av_opt_set_bin()
avconv: Display the error returned by avformat_write_header
rtpenc_chain: Return an error code instead of just a plain pointer
rtpenc_chain: Free the URLContext on failure
rtpenc: Expose the ssrc as an avoption
avprobe: display the codec profile in show_stream()
avprobe: fix function prototype
cosmetics: Fix indentation
avprobe: changelog entry
avprobe: update documentation
avprobe: provide JSON output
avprobe: output proper INI format
avprobe: improve formatting
rtmp: fix url parsing
fate: document TARGET_EXEC and its usage

Conflicts:
doc/APIchanges
doc/fate.texi
doc/ffprobe.texi
ffprobe.c
libavformat/version.h
libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/05/27 05:37:37
Showing 16 changed files
... ...
@@ -44,7 +44,7 @@ Fixes:CVE-2012-2772, CVE-2012-2774, CVE-2012-2775, CVE-2012-2776, CVE-2012-2777,
44 44
 - vorbis parser
45 45
 - png parser
46 46
 - audio mix filter
47
-
47
+- avprobe output is now standard INI or JSON.
48 48
 
49 49
 version 0.10:
50 50
 - Fixes: CVE-2011-3929, CVE-2011-3934, CVE-2011-3935, CVE-2011-3936,
... ...
@@ -31,6 +31,9 @@ API changes, most recent first:
31 31
 2012-03-26 - a67d9cf - lavfi 2.66.100
32 32
   Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
33 33
 
34
+2012-05-25 - e0e0793 - lavu 51.31.0 - opt.h
35
+  Add av_opt_set_bin()
36
+
34 37
 2012-05-15 - lavfi 2.17.0
35 38
   Add support for audio filters
36 39
   ac71230/a2cd9be - add video/audio buffer sink in a new installed
... ...
@@ -78,6 +78,9 @@ Do not put a '~' character in the samples path to indicate a home
78 78
 directory. Because of shell nuances, this will cause FATE to fail.
79 79
 @end float
80 80
 
81
+To use a custom wrapper to run the test, pass @option{--target-exec} to
82
+@command{configure} or set the @var{TARGET_EXEC} Make variable.
83
+
81 84
 
82 85
 @chapter Submitting the results to the FFmpeg result aggregation server
83 86
 
... ...
@@ -168,6 +171,11 @@ the synchronisation of the samples directory.
168 168
     quite useful to detect thread-related regressions.
169 169
 @item CPUFLAGS
170 170
     Specify CPU flags.
171
+@item TARGET_EXEC
172
+    Specify or override the wrapper used to run the tests.
173
+    The @var{TARGET_EXEC} option provides a way to run FATE wrapped in
174
+    @command{valgrind}, @command{qemu-user} or @command{wine} or on remote targets
175
+    through @command{ssh}.
171 176
 @end table
172 177
 
173 178
 Example:
... ...
@@ -194,7 +194,7 @@ content across a TCP/IP network.
194 194
 
195 195
 The required syntax is:
196 196
 @example
197
-rtmp://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
197
+rtmp://@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
198 198
 @end example
199 199
 
200 200
 The accepted parameters are:
... ...
@@ -3294,8 +3294,12 @@ static int transcode_init(void)
3294 3294
     for (i = 0; i < nb_output_files; i++) {
3295 3295
         oc = output_files[i]->ctx;
3296 3296
         oc->interrupt_callback = int_cb;
3297
-        if (avformat_write_header(oc, &output_files[i]->opts) < 0) {
3298
-            snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
3297
+        if ((ret = avformat_write_header(oc, &output_files[i]->opts)) < 0) {
3298
+            char errbuf[128];
3299
+            const char *errbuf_ptr = errbuf;
3300
+            if (av_strerror(ret, errbuf, sizeof(errbuf)) < 0)
3301
+                errbuf_ptr = strerror(AVUNERROR(ret));
3302
+            snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?): %s", i, errbuf_ptr);
3299 3303
             ret = AVERROR(EINVAL);
3300 3304
             goto dump_format;
3301 3305
         }
... ...
@@ -43,9 +43,9 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
43 43
     track->enc->codec_type = AVMEDIA_TYPE_DATA;
44 44
     track->enc->codec_tag  = track->tag;
45 45
 
46
-    track->rtp_ctx = ff_rtp_chain_mux_open(s, src_st, NULL,
47
-                                           RTP_MAX_PACKET_SIZE);
48
-    if (!track->rtp_ctx)
46
+    ret = ff_rtp_chain_mux_open(&track->rtp_ctx, s, src_st, NULL,
47
+                                RTP_MAX_PACKET_SIZE);
48
+    if (ret < 0)
49 49
         goto fail;
50 50
 
51 51
     /* Copy the RTP AVStream timebase back to the hint AVStream */
... ...
@@ -1037,9 +1037,10 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
1037 1037
             fname = next;
1038 1038
             rt->app[0] = '\0';
1039 1039
         } else {
1040
+            // make sure we do not mismatch a playpath for an application instance
1040 1041
             char *c = strchr(p + 1, ':');
1041 1042
             fname = strchr(p + 1, '/');
1042
-            if (!fname || c < fname) {
1043
+            if (!fname || (c && c < fname)) {
1043 1044
                 fname = p + 1;
1044 1045
                 av_strlcpy(rt->app, path + 1, p - path);
1045 1046
             } else {
... ...
@@ -33,6 +33,7 @@
33 33
 static const AVOption options[] = {
34 34
     FF_RTP_FLAG_OPTS(RTPMuxContext, flags)
35 35
     { "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM },
36
+    { "ssrc", "Stream identifier", offsetof(RTPMuxContext, ssrc), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
36 37
     { NULL },
37 38
 };
38 39
 
... ...
@@ -101,7 +102,8 @@ static int rtp_write_header(AVFormatContext *s1)
101 101
     s->base_timestamp = av_get_random_seed();
102 102
     s->timestamp = s->base_timestamp;
103 103
     s->cur_timestamp = 0;
104
-    s->ssrc = av_get_random_seed();
104
+    if (!s->ssrc)
105
+        s->ssrc = av_get_random_seed();
105 106
     s->first_packet = 1;
106 107
     s->first_rtcp_ntp_time = ff_ntp_time();
107 108
     if (s1->start_time_realtime)
... ...
@@ -25,27 +25,31 @@
25 25
 #include "avio_internal.h"
26 26
 #include "libavutil/opt.h"
27 27
 
28
-AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
29
-                                       URLContext *handle, int packet_size)
28
+int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
29
+                          AVStream *st, URLContext *handle, int packet_size)
30 30
 {
31
-    AVFormatContext *rtpctx;
31
+    AVFormatContext *rtpctx = NULL;
32 32
     int ret;
33 33
     AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
34 34
     uint8_t *rtpflags;
35 35
     AVDictionary *opts = NULL;
36 36
 
37
-    if (!rtp_format)
38
-        return NULL;
37
+    if (!rtp_format) {
38
+        ret = AVERROR(ENOSYS);
39
+        goto fail;
40
+    }
39 41
 
40 42
     /* Allocate an AVFormatContext for each output stream */
41 43
     rtpctx = avformat_alloc_context();
42
-    if (!rtpctx)
43
-        return NULL;
44
+    if (!rtpctx) {
45
+        ret = AVERROR(ENOMEM);
46
+        goto fail;
47
+    }
44 48
 
45 49
     rtpctx->oformat = rtp_format;
46 50
     if (!avformat_new_stream(rtpctx, NULL)) {
47
-        av_free(rtpctx);
48
-        return NULL;
51
+        ret = AVERROR(ENOMEM);
52
+        goto fail;
49 53
     }
50 54
     /* Pass the interrupt callback on */
51 55
     rtpctx->interrupt_callback = s->interrupt_callback;
... ...
@@ -79,8 +83,15 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
79 79
             av_free(ptr);
80 80
         }
81 81
         avformat_free_context(rtpctx);
82
-        return NULL;
82
+        return ret;
83 83
     }
84 84
 
85
-    return rtpctx;
85
+    *out = rtpctx;
86
+    return 0;
87
+
88
+fail:
89
+    av_free(rtpctx);
90
+    if (handle)
91
+        ffurl_close(handle);
92
+    return ret;
86 93
 }
... ...
@@ -25,7 +25,7 @@
25 25
 #include "avformat.h"
26 26
 #include "url.h"
27 27
 
28
-AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
29
-                                       URLContext *handle, int packet_size);
28
+int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
29
+                          AVStream *st, URLContext *handle, int packet_size);
30 30
 
31 31
 #endif /* AVFORMAT_RTPENC_CHAIN_H */
... ...
@@ -606,11 +606,13 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
606 606
         s->ctx_flags |= AVFMTCTX_NOHEADER;
607 607
 
608 608
     if (s->oformat && CONFIG_RTSP_MUXER) {
609
-        rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st,
610
-                                      rtsp_st->rtp_handle,
611
-                                      RTSP_TCP_MAX_PACKET_SIZE);
609
+        int ret = ff_rtp_chain_mux_open(&rtsp_st->transport_priv, s, st,
610
+                                        rtsp_st->rtp_handle,
611
+                                        RTSP_TCP_MAX_PACKET_SIZE);
612 612
         /* Ownership of rtp_handle is passed to the rtp mux context */
613 613
         rtsp_st->rtp_handle = NULL;
614
+        if (ret < 0)
615
+            return ret;
614 616
     } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
615 617
         rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
616 618
                                             rtsp_st->dynamic_protocol_context,
... ...
@@ -150,8 +150,10 @@ static int sap_write_header(AVFormatContext *s)
150 150
             ret = AVERROR(EIO);
151 151
             goto fail;
152 152
         }
153
-        s->streams[i]->priv_data = contexts[i] =
154
-            ff_rtp_chain_mux_open(s, s->streams[i], fd, 0);
153
+        ret = ff_rtp_chain_mux_open(&contexts[i], s, s->streams[i], fd, 0);
154
+        if (ret < 0)
155
+            goto fail;
156
+        s->streams[i]->priv_data = contexts[i];
155 157
         av_strlcpy(contexts[i]->filename, url, sizeof(contexts[i]->filename));
156 158
     }
157 159
 
... ...
@@ -209,7 +211,7 @@ static int sap_write_header(AVFormatContext *s)
209 209
     pos += strlen(&sap->ann[pos]) + 1;
210 210
 
211 211
     if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
212
-                       sap->ann_size - pos)) {
212
+                      sap->ann_size - pos)) {
213 213
         ret = AVERROR_INVALIDDATA;
214 214
         goto fail;
215 215
     }
... ...
@@ -31,7 +31,7 @@
31 31
 
32 32
 #define LIBAVFORMAT_VERSION_MAJOR 54
33 33
 #define LIBAVFORMAT_VERSION_MINOR  6
34
-#define LIBAVFORMAT_VERSION_MICRO 100
34
+#define LIBAVFORMAT_VERSION_MICRO 101
35 35
 
36 36
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
37 37
                                                LIBAVFORMAT_VERSION_MINOR, \
... ...
@@ -153,7 +153,7 @@
153 153
  */
154 154
 
155 155
 #define LIBAVUTIL_VERSION_MAJOR 51
156
-#define LIBAVUTIL_VERSION_MINOR 54
156
+#define LIBAVUTIL_VERSION_MINOR 55
157 157
 #define LIBAVUTIL_VERSION_MICRO 100
158 158
 
159 159
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
... ...
@@ -323,6 +323,35 @@ int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
323 323
     return set_number(obj, name, val.num, val.den, 1, search_flags);
324 324
 }
325 325
 
326
+int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags)
327
+{
328
+    void *target_obj;
329
+    const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
330
+    uint8_t *ptr;
331
+    uint8_t **dst;
332
+    int *lendst;
333
+
334
+    if (!o || !target_obj)
335
+        return AVERROR_OPTION_NOT_FOUND;
336
+
337
+    if (o->type != AV_OPT_TYPE_BINARY)
338
+        return AVERROR(EINVAL);
339
+
340
+    ptr = av_malloc(len);
341
+    if (!ptr)
342
+        return AVERROR(ENOMEM);
343
+
344
+    dst = (uint8_t **)(((uint8_t *)target_obj) + o->offset);
345
+    lendst = (int *)(dst + 1);
346
+
347
+    av_free(*dst);
348
+    *dst = ptr;
349
+    *lendst = len;
350
+    memcpy(ptr, val, len);
351
+
352
+    return 0;
353
+}
354
+
326 355
 #if FF_API_OLD_AVOPTIONS
327 356
 /**
328 357
  *
... ...
@@ -562,6 +562,7 @@ int av_opt_set       (void *obj, const char *name, const char *val, int search_f
562 562
 int av_opt_set_int   (void *obj, const char *name, int64_t     val, int search_flags);
563 563
 int av_opt_set_double(void *obj, const char *name, double      val, int search_flags);
564 564
 int av_opt_set_q     (void *obj, const char *name, AVRational  val, int search_flags);
565
+int av_opt_set_bin   (void *obj, const char *name, const uint8_t *val, int size, int search_flags);
565 566
 /**
566 567
  * @}
567 568
  */