diff mbox series

[FFmpeg-devel,5/5] avformat: move AVStream.stream_identifier to AVStreamInternal

Message ID 20210503133200.1434-5-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/5] avformat: move AVStream.last-IP_{pts, duration} to AVStreamInternal
Related show

Checks

Context Check Description
andriy/x86_make fail Make failed
andriy/PPC64_make warning Make failed

Commit Message

James Almer May 3, 2021, 1:32 p.m. UTC
It's a private field, no reason to have it exposed in a public header.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/avformat.h | 7 -------
 libavformat/internal.h | 7 +++++++
 libavformat/mpegts.c   | 4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

Comments

Andreas Rheinhardt May 4, 2021, 6:35 p.m. UTC | #1
James Almer:
> It's a private field, no reason to have it exposed in a public header.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/avformat.h | 7 -------
>  libavformat/internal.h | 7 +++++++
>  libavformat/mpegts.c   | 4 ++--
>  3 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index ecf76b4bfc..d62c3f8744 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1003,13 +1003,6 @@ typedef struct AVStream {
>      int64_t first_dts;
>      int64_t cur_dts;
>  
> -    /**
> -     * Stream Identifier
> -     * This is the MPEG-TS stream identifier +1
> -     * 0 means unknown
> -     */
> -    int stream_identifier;
> -
>      /**
>       * An opaque field for libavformat internal usage.
>       * Must not be accessed in any way by callers.
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 94115960ea..d9423635d2 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -382,6 +382,13 @@ struct AVStreamInternal {
>       * Number of frames that have been demuxed during avformat_find_stream_info()
>       */
>      int codec_info_nb_frames;
> +
> +    /**
> +     * Stream Identifier
> +     * This is the MPEG-TS stream identifier +1
> +     * 0 means unknown
> +     */
> +    int stream_identifier;
>  };
>  
>  #ifdef __GNUC__
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index fb454b9fd3..a02965bacf 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -1995,7 +1995,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
>          }
>          break;
>      case 0x52: /* stream identifier descriptor */
> -        st->stream_identifier = 1 + get8(pp, desc_end);
> +        st->internal->stream_identifier = 1 + get8(pp, desc_end);
>          break;
>      case METADATA_DESCRIPTOR:
>          if (get16(pp, desc_end) == 0xFFFF)
> @@ -2114,7 +2114,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
>              // Listing of data_component_ids is in STD-B10, part 2, Annex J.
>              // Component tag limits are documented in TR-B14, fascicle 2,
>              // Vol. 3, Section 2, 4.2.8.1
> -            int actual_component_tag = st->stream_identifier - 1;
> +            int actual_component_tag = st->internal->stream_identifier - 1;
>              int picked_profile = FF_PROFILE_UNKNOWN;
>              int data_component_id = get16(pp, desc_end);
>              if (data_component_id < 0)
> 
It feels like this should be internal to mpegts.c.

- Andreas
James Almer May 4, 2021, 6:40 p.m. UTC | #2
On 5/4/2021 3:35 PM, Andreas Rheinhardt wrote:
> James Almer:
>> It's a private field, no reason to have it exposed in a public header.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavformat/avformat.h | 7 -------
>>   libavformat/internal.h | 7 +++++++
>>   libavformat/mpegts.c   | 4 ++--
>>   3 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index ecf76b4bfc..d62c3f8744 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -1003,13 +1003,6 @@ typedef struct AVStream {
>>       int64_t first_dts;
>>       int64_t cur_dts;
>>   
>> -    /**
>> -     * Stream Identifier
>> -     * This is the MPEG-TS stream identifier +1
>> -     * 0 means unknown
>> -     */
>> -    int stream_identifier;
>> -
>>       /**
>>        * An opaque field for libavformat internal usage.
>>        * Must not be accessed in any way by callers.
>> diff --git a/libavformat/internal.h b/libavformat/internal.h
>> index 94115960ea..d9423635d2 100644
>> --- a/libavformat/internal.h
>> +++ b/libavformat/internal.h
>> @@ -382,6 +382,13 @@ struct AVStreamInternal {
>>        * Number of frames that have been demuxed during avformat_find_stream_info()
>>        */
>>       int codec_info_nb_frames;
>> +
>> +    /**
>> +     * Stream Identifier
>> +     * This is the MPEG-TS stream identifier +1
>> +     * 0 means unknown
>> +     */
>> +    int stream_identifier;
>>   };
>>   
>>   #ifdef __GNUC__
>> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
>> index fb454b9fd3..a02965bacf 100644
>> --- a/libavformat/mpegts.c
>> +++ b/libavformat/mpegts.c
>> @@ -1995,7 +1995,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
>>           }
>>           break;
>>       case 0x52: /* stream identifier descriptor */
>> -        st->stream_identifier = 1 + get8(pp, desc_end);
>> +        st->internal->stream_identifier = 1 + get8(pp, desc_end);
>>           break;
>>       case METADATA_DESCRIPTOR:
>>           if (get16(pp, desc_end) == 0xFFFF)
>> @@ -2114,7 +2114,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
>>               // Listing of data_component_ids is in STD-B10, part 2, Annex J.
>>               // Component tag limits are documented in TR-B14, fascicle 2,
>>               // Vol. 3, Section 2, 4.2.8.1
>> -            int actual_component_tag = st->stream_identifier - 1;
>> +            int actual_component_tag = st->internal->stream_identifier - 1;
>>               int picked_profile = FF_PROFILE_UNKNOWN;
>>               int data_component_id = get16(pp, desc_end);
>>               if (data_component_id < 0)
>>
> It feels like this should be internal to mpegts.c.

I thought the same, but there is already an internal stream_identifier 
field in a per-stream struct within the muxer handled in a different 
way. So i figured I'd move this now that we are in unstable ABI season, 
and let someone with more insight in the muxer to handle it properly later.
diff mbox series

Patch

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ecf76b4bfc..d62c3f8744 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1003,13 +1003,6 @@  typedef struct AVStream {
     int64_t first_dts;
     int64_t cur_dts;
 
-    /**
-     * Stream Identifier
-     * This is the MPEG-TS stream identifier +1
-     * 0 means unknown
-     */
-    int stream_identifier;
-
     /**
      * An opaque field for libavformat internal usage.
      * Must not be accessed in any way by callers.
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 94115960ea..d9423635d2 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -382,6 +382,13 @@  struct AVStreamInternal {
      * Number of frames that have been demuxed during avformat_find_stream_info()
      */
     int codec_info_nb_frames;
+
+    /**
+     * Stream Identifier
+     * This is the MPEG-TS stream identifier +1
+     * 0 means unknown
+     */
+    int stream_identifier;
 };
 
 #ifdef __GNUC__
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index fb454b9fd3..a02965bacf 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1995,7 +1995,7 @@  int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
         }
         break;
     case 0x52: /* stream identifier descriptor */
-        st->stream_identifier = 1 + get8(pp, desc_end);
+        st->internal->stream_identifier = 1 + get8(pp, desc_end);
         break;
     case METADATA_DESCRIPTOR:
         if (get16(pp, desc_end) == 0xFFFF)
@@ -2114,7 +2114,7 @@  int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
             // Listing of data_component_ids is in STD-B10, part 2, Annex J.
             // Component tag limits are documented in TR-B14, fascicle 2,
             // Vol. 3, Section 2, 4.2.8.1
-            int actual_component_tag = st->stream_identifier - 1;
+            int actual_component_tag = st->internal->stream_identifier - 1;
             int picked_profile = FF_PROFILE_UNKNOWN;
             int data_component_id = get16(pp, desc_end);
             if (data_component_id < 0)