From 7cbc2e60af72e2154ddc160b1bfce200a95a6532 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 16 Jun 2011 07:24:14 +0200 Subject: [PATCH 1/5] codec-regression: remove pointless -r options for dnxhd --- tests/codec-regression.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh index 335e1f70f7..a858250e2f 100755 --- a/tests/codec-regression.sh +++ b/tests/codec-regression.sh @@ -219,17 +219,17 @@ fi if [ -n "$do_dnxhd_1080i" ] ; then # FIXME: interlaced raw DNxHD decoding is broken do_video_encoding dnxhd-1080i.mov "-vcodec dnxhd -flags +ildct -s hd1080 -b 120M -pix_fmt yuv422p -vframes 5 -an" -do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p" +do_video_decoding "" "-s cif -pix_fmt yuv420p" fi if [ -n "$do_dnxhd_720p" ] ; then do_video_encoding dnxhd-720p.dnxhd "-s hd720 -b 90M -pix_fmt yuv422p -vframes 5 -an" -do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p" +do_video_decoding "" "-s cif -pix_fmt yuv420p" fi if [ -n "$do_dnxhd_720p_rd" ] ; then do_video_encoding dnxhd-720p-rd.dnxhd "-threads 4 -mbd rd -s hd720 -b 90M -pix_fmt yuv422p -vframes 5 -an" -do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p" +do_video_decoding "" "-s cif -pix_fmt yuv420p" fi if [ -n "$do_svq1" ] ; then From 6095388812ce1b2a95e9917b89e5857639208f88 Mon Sep 17 00:00:00 2001 From: Kirill Zorin Date: Wed, 15 Jun 2011 19:18:29 +0200 Subject: [PATCH 2/5] mmsh: fixed printf injection bug in mmsh request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/mmsh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c index b19973ea76..af040e27a9 100644 --- a/libavformat/mmsh.c +++ b/libavformat/mmsh.c @@ -231,7 +231,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) host, sizeof(host), &port, path, sizeof(path), location); if (port<0) port = 80; // default mmsh protocol port - ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, path); + ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, "%s", path); if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ) < 0) { return AVERROR(EIO); From d840733937a3f00dcedbf20507077a4891173516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 16 Jun 2011 11:04:27 +0300 Subject: [PATCH 3/5] rtsp: Don't pass string pointer as format string to ff_url_join MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this case, the string that was passed couldn't contain user-defined data and thus there was no risk for injection bugs, but it's safer this way, if we later change the content of the options string. Signed-off-by: Martin Storsjö --- libavformat/rtsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index b2735f6165..eeea9be4a0 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1234,10 +1234,10 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, if (reply->transports[0].source[0]) { ff_url_join(url, sizeof(url), "rtp", NULL, reply->transports[0].source, - reply->transports[0].server_port_min, options); + reply->transports[0].server_port_min, "%s", options); } else { ff_url_join(url, sizeof(url), "rtp", NULL, host, - reply->transports[0].server_port_min, options); + reply->transports[0].server_port_min, "%s", options); } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { From 1d076f46a0db987e3cde0914277473f18f1ba03e Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 16 Jun 2011 17:04:06 +0200 Subject: [PATCH 4/5] rtpenc_latm: Consistently use "Libav" in license boilerplate. --- libavformat/rtpenc_latm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpenc_latm.c b/libavformat/rtpenc_latm.c index aa6e29117f..64676771a7 100644 --- a/libavformat/rtpenc_latm.c +++ b/libavformat/rtpenc_latm.c @@ -9,13 +9,13 @@ * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * FFmpeg is distributed in the hope that it will be useful, + * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ From 9446d75941d639f19cfa9ae007eb4c5ca041f200 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 16 Jun 2011 18:04:56 +0200 Subject: [PATCH 5/5] ffmpeg: merge output_codecs array into AVOutputStream members. There's no point in keeping them separate. --- ffmpeg.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 1b31d5655f..652fbfce32 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -113,9 +113,7 @@ static int nb_input_codecs = 0; static int nb_input_files_ts_scale[MAX_FILES] = {0}; static AVFormatContext *output_files[MAX_FILES]; -static AVCodec **output_codecs = NULL; static int nb_output_files = 0; -static int nb_output_codecs = 0; static AVStreamMap *stream_maps = NULL; static int nb_stream_maps; @@ -264,6 +262,8 @@ typedef struct AVOutputStream { struct AVInputStream *sync_ist; /* input stream to sync against */ int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ //FIXME look at frame_number AVBitStreamFilterContext *bitstream_filters; + AVCodec *enc; + /* video only */ int video_resample; AVFrame pict_tmp; /* temporary image for resampling */ @@ -480,7 +480,6 @@ static int ffmpeg_exit(int ret) av_free(streamid_map); av_free(input_codecs); - av_free(output_codecs); av_free(stream_maps); av_free(meta_data_maps); @@ -2296,7 +2295,7 @@ static int transcode(AVFormatContext **output_files, for(i=0;iencoding_needed) { - AVCodec *codec = i < nb_output_codecs ? output_codecs[i] : NULL; + AVCodec *codec = ost->enc; AVCodecContext *dec = input_streams[ost->source_index].st->codec; if (!codec) codec = avcodec_find_encoder(ost->st->codec->codec_id); @@ -3418,13 +3417,12 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) } ost = new_output_stream(oc, file_idx); - output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!video_stream_copy){ if (video_codec_name) { codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1, avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance); codec = avcodec_find_encoder_by_name(video_codec_name); - output_codecs[nb_output_codecs-1] = codec; + ost->enc = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); codec = avcodec_find_encoder(codec_id); @@ -3561,13 +3559,12 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) } ost = new_output_stream(oc, file_idx); - output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!audio_stream_copy){ if (audio_codec_name) { codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1, avcodec_opts[AVMEDIA_TYPE_AUDIO]->strict_std_compliance); codec = avcodec_find_encoder_by_name(audio_codec_name); - output_codecs[nb_output_codecs-1] = codec; + ost->enc = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO); codec = avcodec_find_encoder(codec_id); @@ -3633,7 +3630,6 @@ static void new_data_stream(AVFormatContext *oc, int file_idx) } new_output_stream(oc, file_idx); data_enc = st->codec; - output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if (!data_stream_copy) { fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n"); ffmpeg_exit(1); @@ -3673,12 +3669,12 @@ static void new_subtitle_stream(AVFormatContext *oc, int file_idx) } ost = new_output_stream(oc, file_idx); subtitle_enc = st->codec; - output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!subtitle_stream_copy){ if (subtitle_codec_name) { codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); - codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name); + codec = avcodec_find_encoder_by_name(subtitle_codec_name); + ost->enc = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE); codec = avcodec_find_encoder(codec_id);