diff mbox series

[FFmpeg-devel,1/2] avformat/mpegtsenc: move is_dvb_subtitle/is_dvb_teletext initialization upwards

Message ID 20210424171339.8790-1-cus@passwd.hu
State Accepted
Commit b9fff6e15e73dc995695db9be8db084238cca14c
Headers show
Series [FFmpeg-devel,1/2] avformat/mpegtsenc: move is_dvb_subtitle/is_dvb_teletext initialization upwards | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Marton Balint April 24, 2021, 5:13 p.m. UTC
Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/mpegtsenc.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

Comments

Marton Balint April 28, 2021, 7:39 p.m. UTC | #1
On Sat, 24 Apr 2021, Marton Balint wrote:

> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavformat/mpegtsenc.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index a357f3a6aa..8ff834be4e 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -1300,8 +1300,10 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
>     MpegTSWrite *ts = s->priv_data;
>     uint8_t buf[TS_PACKET_SIZE];
>     uint8_t *q;
> -    int val, is_start, len, header_len, write_pcr, is_dvb_subtitle, is_dvb_teletext, flags;
> +    int val, is_start, len, header_len, write_pcr, flags;
>     int afc_len, stuffing_len;
> +    int is_dvb_subtitle = (st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE);
> +    int is_dvb_teletext = (st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT);
>     int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
>     int force_pat = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && key && !ts_st->prev_payload_key;
>     int force_sdt = 0;
> @@ -1412,8 +1414,6 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
>             *q++ = 0x00;
>             *q++ = 0x00;
>             *q++ = 0x01;
> -            is_dvb_subtitle = 0;
> -            is_dvb_teletext = 0;
>             if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
>                 if (st->codecpar->codec_id == AV_CODEC_ID_DIRAC)
>                     *q++ = STREAM_ID_EXTENDED_STREAM_ID;
> @@ -1438,13 +1438,6 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
>                     pts = dts = AV_NOPTS_VALUE;
>             } else {
>                 *q++ = STREAM_ID_PRIVATE_STREAM_1;
> -                if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
> -                    if (st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
> -                        is_dvb_subtitle = 1;
> -                    } else if (st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT) {
> -                        is_dvb_teletext = 1;
> -                    }
> -                }
>             }
>             header_len = 0;
>             flags      = 0;

Applied the series.

Regards,
Marton
diff mbox series

Patch

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index a357f3a6aa..8ff834be4e 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1300,8 +1300,10 @@  static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
     MpegTSWrite *ts = s->priv_data;
     uint8_t buf[TS_PACKET_SIZE];
     uint8_t *q;
-    int val, is_start, len, header_len, write_pcr, is_dvb_subtitle, is_dvb_teletext, flags;
+    int val, is_start, len, header_len, write_pcr, flags;
     int afc_len, stuffing_len;
+    int is_dvb_subtitle = (st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE);
+    int is_dvb_teletext = (st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT);
     int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
     int force_pat = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && key && !ts_st->prev_payload_key;
     int force_sdt = 0;
@@ -1412,8 +1414,6 @@  static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
             *q++ = 0x00;
             *q++ = 0x00;
             *q++ = 0x01;
-            is_dvb_subtitle = 0;
-            is_dvb_teletext = 0;
             if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
                 if (st->codecpar->codec_id == AV_CODEC_ID_DIRAC)
                     *q++ = STREAM_ID_EXTENDED_STREAM_ID;
@@ -1438,13 +1438,6 @@  static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
                     pts = dts = AV_NOPTS_VALUE;
             } else {
                 *q++ = STREAM_ID_PRIVATE_STREAM_1;
-                if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-                    if (st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
-                        is_dvb_subtitle = 1;
-                    } else if (st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT) {
-                        is_dvb_teletext = 1;
-                    }
-                }
             }
             header_len = 0;
             flags      = 0;