[FFmpeg-devel] [PATCH] options to set stream id (custom TS pid)

Michael Niedermayer michaelni
Wed Jun 16 23:11:14 CEST 2010


On Wed, Jun 16, 2010 at 04:22:21PM -0400, Mike Scheutzow wrote:
> Stefano Sabatini wrote:
>>> Index: ffmpeg.c
>> [...]  
>>> +/* arg format is "output-stream-index:streamid-value". */
>>> +static void opt_streamid(const char *opt, const char *arg)
>>> +{
>>> +    int idx;
>>> +    char *p;
>>> +
>>> +    idx = strtol(arg, &p, 0);
>>> +    if (*p != ':' || idx < 0 || idx >= MAX_STREAMS) {
>>> +        fprintf(stderr, "Invalid %s '%s'\n", opt, arg);
>>> +        av_exit(1);
>>> +    }
>> I'm still a bit unstatisfied about this, this will accept invalid
>> string, maybe you could pre-parse the string before. Anyway please use
>> a explicative message, for example:
>> "Invalid value '%s' for option '%s', not a number or not in the range %d - 
>> %d".
>
> Implemented the pre-parsing in ffmpeg_set_streamid_v5.patch, and retested.
>
>> Rest of the patch looks fine to me.
>
>
> Mike Scheutzow

>  doc/ffmpeg-doc.texi |    9 +++++++++
>  ffmpeg.c            |   33 ++++++++++++++++++++++++++++++---
>  2 files changed, 39 insertions(+), 3 deletions(-)
> 440c484c7091319d2797879f215e0c46e40d4b08  ffmpeg_set_streamid_v5.patch
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 23373)
> +++ ffmpeg.c	(working copy)
> @@ -121,6 +121,9 @@
>  static AVMetaDataMap meta_data_maps[MAX_FILES];
>  static int nb_meta_data_maps;
>  
> +/* indexed by output file stream index */
> +static int streamid_map[MAX_STREAMS];

how messy would it be to dynamically allocate this?
or if not indexes should be checked to be withinn 0...MAX_STREAMS
somewhere at least

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100616/dbdcce5b/attachment.pgp>



More information about the ffmpeg-devel mailing list