2015.10.04. 20:06 keltezéssel, Nicolas George írta:
Le tridi 13 vendémiaire, an CCXXIV, Bodecs Bela a écrit :
git format-patch -n -o /tmp/ --attach  origin
Thanks. Any particular reason to use --attach? It is not a big issue, just a
matter of curiosity.
I thought I should use it this way to be able to send the created patch file later with any mailer.


@@ -172,15 +175,26 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
      for (i = 0; i < avf->nb_streams; i++) {
          st = avf->streams[i];
          if (select) {
-            ret = avformat_match_stream_specifier(avf, avf->streams[i], 
select);
-            if (ret < 0) {
-                av_log(avf, AV_LOG_ERROR,
-                       "Invalid stream specifier '%s' for output '%s'\n",
-                       select, slave);
-                goto end;
-            }
+            fullret = 0;
+            first_subselect = select;
+            next_subselect = NULL;
+            while (subselect = av_strtok(first_subselect, slave_select_sep, 
&next_subselect)) {
+                first_subselect = NULL;
You would be right unless I used

first_subselect = NULL;

right after the while statement, so the next round av_strtok will go
further, because the first parameter will be null, not the same string and
next_subselect will point the next start.
Yes it is destructive, but we never use this string (select) again in this
function.
I suspect we are talking at cross-purpose here. The "first_subselect = NULL"
you are talking about is in the while loop for av_strtok(), it is indeed the
normal way of using av_strtok().

But I was talking about the surrounding for loop that goes over all the
streams. I left the code quoted above for reference. For i=0, the code is
valid, but as soon as i>=1, "first_subselect = select" will use a truncated
string

I swear, I have really tested it, I use it on my own  in my production
environment.
I do not believe that you neglected to test it (nor that you are lying, of
course!), I am just really surprised. Just to be sure, I just tested, adding
a debug log just after "first_subselect = select", with the following
command-line:

./ffmpeg_g -lavfi 'testsrc=r=5;testsrc=r=7;testsrc=r=11' \
   -c:v rawvideo -f tee '[f=framecrc:select=0,1]-'

I get the following output:

select = '0,1'
select = '0'
     Last message repeated 1 times
[tee @ 0x36143e0] Input stream #1 is not mapped to any slave.
[tee @ 0x36143e0] Input stream #2 is not mapped to any slave.

The second "select =" line shows that it is working with a truncated line,
and stream #1 should be mapped. Indeed, if I swap the specifiers: "1,0", it
maps #0 and #1: #0 is matched first while the string is still intact, #1 is
matched by the truncated string.

Regards,



you are right. It is my mistake that I did not test it thoughtfully. It was bad luck why I did not receive error still now. I will correct the patch as soon as possible and send it again. I think I will use the av_strdup() to correct it. (and av_free, of course)

thank you,

Bela Bodecs


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to