On 02/08/2015 11:10 PM, Michael Niedermayer wrote:
On Sun, Feb 08, 2015 at 10:42:43PM +0530, Anshul wrote:
On 01/16/2015 07:21 AM, Michael Niedermayer wrote:
@@ -1927,6 +1932,11 @@ static int open_output_file(OptionsContext *o, const 
char *filename)
                  }
          }
          /* do something with data? */
+        if (!o->data_disable && av_guess_codec(oc->oformat, NULL, filename, 
NULL, AVMEDIA_TYPE_DATA) != AV_CODEC_ID_NONE) {
+            for (i = 0; i < nb_input_streams; i++)
+                if (input_streams[i]->st->codec->codec_type == 
AVMEDIA_TYPE_DATA)
+                    new_data_stream(o, oc, i);
+        }
this probably needs something "more" to work, like we wouldnt
want to matchup a data stream with GPS data to a scte_35 stream
iam not sure how to best do this though
for stream copy the codec_id could be used though i guess

working on it.

-Anshul
I have attached new patch, using codec_id for match.
-Anshul
>From b4480e70d6d18c2eebbbc65a0317b2b790a7ee49 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari <er.anshul.maheshw...@gmail.com>
Date: Sun, 15 Feb 2015 15:24:01 +0530
Subject: [PATCH] Creating new data stream for output format context

Signed-off-by: Anshul Maheshwari <er.anshul.maheshw...@gmail.com>

if input codec Id match with expected data stream of output format context
then only new stream with same codec id is created.
---
 ffmpeg_opt.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 56b882e..3eb8e8c 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1935,7 +1935,15 @@ static int open_output_file(OptionsContext *o, const char *filename)
                     }
                 }
         }
-        /* do something with data? */
+        /* Data only if codec id match */
+        if (!o->data_disable ) {
+            enum AVCodecID codec_id = av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_DATA);
+            for (i = 0; codec_id != AV_CODEC_ID_NONE && i < nb_input_streams; i++) {
+                if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_DATA
+                         && input_streams[i]->st->codec->codec_id == codec_id )
+                        new_data_stream(o, oc, i);
+                }
+        }
     } else {
         for (i = 0; i < o->nb_stream_maps; i++) {
             StreamMap *map = &o->stream_maps[i];
-- 
2.1.4

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

Reply via email to