[FFmpeg-devel] [PATCH 17/21] libavcodec/avcodec, libavformat/movenc: introduced AV_PKT_DATA_TRACK_ALTERNATE_GROUP side data for expressing alternate groups
erkki.seppala.ext at nokia.com
erkki.seppala.ext at nokia.com
Tue Aug 23 12:03:35 EEST 2016
From: Erkki Seppälä <erkki.seppala.ext at nokia.com>
Alternate groups previously always generated for ISO media files. With
this addition client code can define track groups arbitrarily.
Signed-off-by: Erkki Seppälä <erkki.seppala.ext at nokia.com>
Signed-off-by: OZOPlayer <OZOPL at nokia.com>
---
libavcodec/avcodec.h | 13 ++++++++++++-
libavformat/movenc.c | 9 +++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6c64e6a..9d69911 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1605,7 +1605,18 @@ enum AVPacketSideDataType {
* The channel layout is object structured with the number of objects in
* AVAudioTrackChannelLayoutObjectStructured
*/
- AV_PKT_DATA_AUDIO_CHANNEL_LAYOUT_OBJECT_STRUCTURED
+ AV_PKT_DATA_AUDIO_CHANNEL_LAYOUT_OBJECT_STRUCTURED,
+
+ /**
+ * Assign alternate groups for tracks. An example of alternate
+ * groups would be audio tracks (or video tracks) that are
+ * alternative to each other. Each alternative track shares the
+ * same non-zero alternate group.
+ *
+ * The content is:
+ * uint: The alternate group of this track
+ */
+ AV_PKT_DATA_TRACK_ALTERNATE_GROUP
};
#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 9606918..94d978b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2567,6 +2567,8 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
int flags = MOV_TKHD_FLAG_IN_MOVIE;
int rotation = 0;
int group = 0;
+ int *alternate_group = NULL;
+ int alternate_group_size;
uint32_t *display_matrix = NULL;
int display_matrix_size, i;
@@ -2583,6 +2585,13 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
display_matrix = NULL;
}
+ if (st) {
+ alternate_group = (int*) av_stream_get_side_data(st, AV_PKT_DATA_TRACK_ALTERNATE_GROUP,
+ &alternate_group_size);
+ if (alternate_group && alternate_group_size >= sizeof(int))
+ group = *alternate_group;
+ }
+
if (track->flags & MOV_TRACK_ENABLED)
flags |= MOV_TKHD_FLAG_ENABLED;
--
2.7.4
More information about the ffmpeg-devel
mailing list