diff mbox

[FFmpeg-devel] lavf/rawdec: Do not mark raw subtitle streams as data streams

Message ID CAB0OVGrMztczBWj4==-CTE6cevmg-qQ4ft=U8_dxccwYipLaWA@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Nov. 27, 2018, 5:24 p.m. UTC
Hi!

Attached patch improves the "ffmpeg -i" output for raw dvbsub files.

Please comment, Carl Eugen

Comments

Michael Niedermayer Nov. 28, 2018, 8:21 p.m. UTC | #1
On Tue, Nov 27, 2018 at 06:24:15PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch improves the "ffmpeg -i" output for raw dvbsub files.
> 
> Please comment, Carl Eugen

>  rawdec.c |   11 +++++++++++
>  rawdec.h |    4 +++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 72597d4a785a23105a2eba5f57b5cc3bc1f95f93  0001-lavf-rawdec-Do-not-mark-streams-from-raw-subtitle-de.patch
> From 6cddd293354c75a20ae54e0ea62898c128826601 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> Date: Tue, 27 Nov 2018 18:22:02 +0100
> Subject: [PATCH] lavf/rawdec: Do not mark streams from raw subtitle demuxers
>  as data streams.
> 
> Improves "ffmpeg -i" output for raw dvbsub files.
> ---
>  libavformat/rawdec.c |   11 +++++++++++
>  libavformat/rawdec.h |    4 +++-
>  2 files changed, 14 insertions(+), 1 deletion(-)

should be ok

thx

[...]
Carl Eugen Hoyos Nov. 28, 2018, 9:52 p.m. UTC | #2
2018-11-28 21:21 GMT+01:00, Michael Niedermayer <michael@niedermayer.cc>:
> On Tue, Nov 27, 2018 at 06:24:15PM +0100, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch improves the "ffmpeg -i" output for raw dvbsub files.
>>
>> Please comment, Carl Eugen
>
>>  rawdec.c |   11 +++++++++++
>>  rawdec.h |    4 +++-
>>  2 files changed, 14 insertions(+), 1 deletion(-)
>> 72597d4a785a23105a2eba5f57b5cc3bc1f95f93
>> 0001-lavf-rawdec-Do-not-mark-streams-from-raw-subtitle-de.patch
>> From 6cddd293354c75a20ae54e0ea62898c128826601 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
>> Date: Tue, 27 Nov 2018 18:22:02 +0100
>> Subject: [PATCH] lavf/rawdec: Do not mark streams from raw subtitle
>> demuxers
>>  as data streams.
>>
>> Improves "ffmpeg -i" output for raw dvbsub files.
>> ---
>>  libavformat/rawdec.c |   11 +++++++++++
>>  libavformat/rawdec.h |    4 +++-
>>  2 files changed, 14 insertions(+), 1 deletion(-)
>
> should be ok

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

From 6cddd293354c75a20ae54e0ea62898c128826601 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Tue, 27 Nov 2018 18:22:02 +0100
Subject: [PATCH] lavf/rawdec: Do not mark streams from raw subtitle demuxers
 as data streams.

Improves "ffmpeg -i" output for raw dvbsub files.
---
 libavformat/rawdec.c |   11 +++++++++++
 libavformat/rawdec.h |    4 +++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index b38a4b5..6249352 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -91,6 +91,17 @@  fail:
     return ret;
 }
 
+int ff_raw_subtitle_read_header(AVFormatContext *s)
+{
+    AVStream *st = avformat_new_stream(s, NULL);
+    if (!st)
+        return AVERROR(ENOMEM);
+    st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
+    st->codecpar->codec_id = s->iformat->raw_codec_id;
+    st->start_time = 0;
+    return 0;
+}
+
 int ff_raw_data_read_header(AVFormatContext *s)
 {
     AVStream *st = avformat_new_stream(s, NULL);
diff --git a/libavformat/rawdec.h b/libavformat/rawdec.h
index a464bbb..3eb416b 100644
--- a/libavformat/rawdec.h
+++ b/libavformat/rawdec.h
@@ -41,6 +41,8 @@  int ff_raw_audio_read_header(AVFormatContext *s);
 
 int ff_raw_video_read_header(AVFormatContext *s);
 
+int ff_raw_subtitle_read_header(AVFormatContext *s);
+
 int ff_raw_data_read_header(AVFormatContext *s);
 
 #define FF_RAWVIDEO_DEMUXER_CLASS(name)\
@@ -83,7 +85,7 @@  AVInputFormat ff_ ## shortname ## _demuxer = {\
     .name           = #shortname,\
     .long_name      = NULL_IF_CONFIG_SMALL(longname),\
     .read_probe     = probe,\
-    .read_header    = ff_raw_data_read_header,\
+    .read_header    = ff_raw_subtitle_read_header,\
     .read_packet    = ff_raw_read_partial_packet,\
     .extensions     = ext,\
     .flags          = flag,\
-- 
1.7.10.4