Re: [FFmpeg-devel] [RFC] avformat: access AVFormatContext.filename[] filed via getter/setter.

2015-09-14 Thread Nicolas George
L'octidi 28 fructidor, an CCXXIII, Zhang Rui a écrit :
> I'd like to know if this API-change could happen, since it will break
> many things.

It depends on the decision about ABI compatibility, that itself depends on
the decision about the decision process.

Assuming we will stop ABI compatibility, I am rather for replacing the fixed
buffer by a mallocated one with a setter function. OTOH, I am not very fond
of a getter.

Regards,

-- 
  Nicolas George
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [RFC] avformat: access AVFormatContext.filename[] filed via getter/setter.

2015-09-14 Thread Zhang Rui
URLs longer than 1024 could be truncated by AVFormatContext.
The field filename[1024] should be replaced with allocated string in future.
---
 ffmpeg.c |  8 +++
 ffmpeg_opt.c |  8 +++
 ffplay.c | 20 +-
 ffprobe.c|  2 +-
 ffserver.c   | 20 +++---
 libavdevice/avfoundation.m   |  2 +-
 libavdevice/lavfi.c  |  2 +-
 libavdevice/qtkit.m  |  8 +++
 libavdevice/sdl.c|  2 +-
 libavformat/avformat.h   |  9 +---
 libavformat/concatdec.c  |  4 ++--
 libavformat/dashenc.c| 12 +--
 libavformat/gxfenc.c |  4 ++--
 libavformat/hdsenc.c | 24 ++---
 libavformat/hls.c|  2 +-
 libavformat/hlsenc.c | 45 +---
 libavformat/img2dec.c|  4 ++--
 libavformat/img2enc.c|  4 ++--
 libavformat/matroskadec.c|  4 ++--
 libavformat/mlvdec.c |  4 ++--
 libavformat/mov.c|  2 +-
 libavformat/movenc.c | 10 -
 libavformat/mpeg.c   |  4 ++--
 libavformat/mpegtsenc.c  |  2 +-
 libavformat/mux.c|  2 +-
 libavformat/nsvdec.c |  2 +-
 libavformat/rtsp.c   | 10 -
 libavformat/rtspdec.c|  4 ++--
 libavformat/sapdec.c |  2 +-
 libavformat/sapenc.c |  4 ++--
 libavformat/sdp.c|  4 ++--
 libavformat/segment.c| 36 ++--
 libavformat/smoothstreamingenc.c | 12 +--
 libavformat/tee.c|  6 +++---
 libavformat/utils.c  | 17 +--
 libavformat/webm_chunk.c | 12 ++-
 36 files changed, 174 insertions(+), 143 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index e31a2c6..048a46d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1447,7 +1447,7 @@ static void print_final_stats(int64_t total_size)
 uint64_t total_packets = 0, total_size = 0;
 
 av_log(NULL, AV_LOG_VERBOSE, "Input file #%d (%s):\n",
-   i, f->ctx->filename);
+   i, av_format_get_filename(f->ctx));
 
 for (j = 0; j < f->nb_streams; j++) {
 InputStream *ist = input_streams[f->ist_index + j];
@@ -1481,7 +1481,7 @@ static void print_final_stats(int64_t total_size)
 uint64_t total_packets = 0, total_size = 0;
 
 av_log(NULL, AV_LOG_VERBOSE, "Output file #%d (%s):\n",
-   i, of->ctx->filename);
+   i, av_format_get_filename(of->ctx));
 
 for (j = 0; j < of->ctx->nb_streams; j++) {
 OutputStream *ost = output_streams[of->ost_index + j];
@@ -3220,7 +3220,7 @@ static int transcode_init(void)
 /* dump the file output parameters - cannot be done before in case
of stream copy */
 for (i = 0; i < nb_output_files; i++) {
-av_dump_format(output_files[i]->ctx, i, 
output_files[i]->ctx->filename, 1);
+av_dump_format(output_files[i]->ctx, i, 
av_format_get_filename(output_files[i]->ctx), 1);
 }
 
 /* dump the stream mapping */
@@ -3636,7 +3636,7 @@ static int process_input(int file_index)
 }
 if (ret < 0) {
 if (ret != AVERROR_EOF) {
-print_error(is->filename, ret);
+print_error(av_format_get_filename(is), ret);
 if (exit_on_error)
 exit_program(1);
 }
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 55818e1..746dd50 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1118,7 +1118,7 @@ static void choose_encoder(OptionsContext *o, 
AVFormatContext *s, OutputStream *
 
 MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
 if (!codec_name) {
-ost->st->codec->codec_id = av_guess_codec(s->oformat, NULL, 
s->filename,
+ost->st->codec->codec_id = av_guess_codec(s->oformat, NULL, 
av_format_get_filename(s),
   NULL, 
ost->st->codec->codec_type);
 ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
 } else if (!strcmp(codec_name, "copy"))
@@ -2179,7 +2179,7 @@ loop_end:
 }
 
 if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {
-av_dump_format(oc, nb_output_files - 1, oc->filename, 1);
+av_dump_format(oc, nb_output_files - 1, av_format_get_filename(oc), 1);
 av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any 
stream\n", nb_output_files - 1);
 exit_program(1);
 }
@@ -2239,8 +2239,8 @@ loop_end:
 
 /* check filename in case of an image number is expected */
 if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
-if (!av_filename_number_test(oc->filename)) {
-print_error(oc->filename, AVERROR(EINVAL));
+if (!av_filename_number_test(av_format_get_filename(oc))) {
+

Re: [FFmpeg-devel] [RFC] avformat: access AVFormatContext.filename[] filed via getter/setter.

2015-09-14 Thread Zhang Rui
2015-09-14 17:48 GMT+08:00 Zhang Rui :
> URLs longer than 1024 could be truncated by AVFormatContext.
> The field filename[1024] should be replaced with allocated string in future.

I'd like to know if this API-change could happen, since it will break
many things.

And there is one direct usage of filename left in libavformat/rtspenc.c
which I'm not quite sure how to modify

/* We create the SDP based on the RTSP AVFormatContext where we
 * aren't allowed to change the filename field. (We create the SDP
 * based on the RTSP context since the contexts for the RTP streams
 * don't exist yet.) In order to specify a custom URL with the actual
 * peer IP instead of the originally specified hostname, we create
 * a temporary copy of the AVFormatContext, where the custom URL is set.
 *
 * FIXME: Create the SDP without copying the AVFormatContext.
 * This either requires setting up the RTP stream AVFormatContexts
 * already here (complicating things immensely) or getting a more
 * flexible SDP creation interface.
 */
sdp_ctx = *s;
ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename),
"rtsp", NULL, addr, -1, NULL);

If the API-change could happen, I will take more investigation into this.

> ---
>  ffmpeg.c |  8 +++
>  ffmpeg_opt.c |  8 +++
>  ffplay.c | 20 +-
>  ffprobe.c|  2 +-
>  ffserver.c   | 20 +++---
>  libavdevice/avfoundation.m   |  2 +-
>  libavdevice/lavfi.c  |  2 +-
>  libavdevice/qtkit.m  |  8 +++
>  libavdevice/sdl.c|  2 +-
>  libavformat/avformat.h   |  9 +---
>  libavformat/concatdec.c  |  4 ++--
>  libavformat/dashenc.c| 12 +--
>  libavformat/gxfenc.c |  4 ++--
>  libavformat/hdsenc.c | 24 ++---
>  libavformat/hls.c|  2 +-
>  libavformat/hlsenc.c | 45 
> +---
>  libavformat/img2dec.c|  4 ++--
>  libavformat/img2enc.c|  4 ++--
>  libavformat/matroskadec.c|  4 ++--
>  libavformat/mlvdec.c |  4 ++--
>  libavformat/mov.c|  2 +-
>  libavformat/movenc.c | 10 -
>  libavformat/mpeg.c   |  4 ++--
>  libavformat/mpegtsenc.c  |  2 +-
>  libavformat/mux.c|  2 +-
>  libavformat/nsvdec.c |  2 +-
>  libavformat/rtsp.c   | 10 -
>  libavformat/rtspdec.c|  4 ++--
>  libavformat/sapdec.c |  2 +-
>  libavformat/sapenc.c |  4 ++--
>  libavformat/sdp.c|  4 ++--
>  libavformat/segment.c| 36 ++--
>  libavformat/smoothstreamingenc.c | 12 +--
>  libavformat/tee.c|  6 +++---
>  libavformat/utils.c  | 17 +--
>  libavformat/webm_chunk.c | 12 ++-
>  36 files changed, 174 insertions(+), 143 deletions(-)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel