aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2018-05-15 11:26:07 -0700
committerAman Gupta <aman@tmm1.net>2018-05-17 12:03:22 -0700
commit5dfeb7f0811c0b64d68e80296067fa8fed57beee (patch)
treec2ec0062b74dbb00be030632b4111f21541e2f36
parent2734f8d63a3864d09f9e1359a8f5af4f13c70ac9 (diff)
downloadffmpeg-5dfeb7f0811c0b64d68e80296067fa8fed57beee.tar.gz
avformat/mpegts: tag video streams with still images
Parses the video_stream_descriptor (H.222 2.6.2) to look for the still_picture_flag. This is exposed to the user via a new AV_DISPOSITION_STILL_IMAGE. See for example https://tmm1.s3.amazonaws.com/music-choice.ts, whose video stream only updates every ~6 seconds. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--doc/APIchanges3
-rw-r--r--libavformat/avformat.h1
-rw-r--r--libavformat/dump.c2
-rw-r--r--libavformat/mpegts.c5
-rw-r--r--libavformat/version.h4
5 files changed, 13 insertions, 2 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index bbefc8356e..befa58c84a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
+2018-05-xx - xxxxxxxxxx - lavf 58.14.100 - avformat.h
+ Add AV_DISPOSITION_STILL_IMAGE
+
2018-05-xx - xxxxxxxxxx - lavu 56.18.101 - hwcontext_cuda.h
Add AVCUDADeviceContext.stream.
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 669ddb423e..6dce88fad5 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -846,6 +846,7 @@ typedef struct AVStreamInternal AVStreamInternal;
#define AV_DISPOSITION_DESCRIPTIONS 0x20000
#define AV_DISPOSITION_METADATA 0x40000
#define AV_DISPOSITION_DEPENDENT 0x80000 ///< dependent audio stream (mix_type=0 in mpegts)
+#define AV_DISPOSITION_STILL_IMAGE 0x100000 ///< still images in video stream (still_picture_flag=1 in mpegts)
/**
* Options for behavior on timestamp wrap detection.
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 942e62a581..bc0f401550 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -551,6 +551,8 @@ static void dump_stream_format(AVFormatContext *ic, int i,
av_log(NULL, AV_LOG_INFO, " (descriptions)");
if (st->disposition & AV_DISPOSITION_DEPENDENT)
av_log(NULL, AV_LOG_INFO, " (dependent)");
+ if (st->disposition & AV_DISPOSITION_STILL_IMAGE)
+ av_log(NULL, AV_LOG_INFO, " (still image)");
av_log(NULL, AV_LOG_INFO, "\n");
dump_metadata(NULL, st->metadata, " ");
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 9cc00c7eae..fc9bb3940e 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1683,6 +1683,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
mpegts_find_stream_type(st, desc_tag, DESC_types);
switch (desc_tag) {
+ case 0x02: /* video stream descriptor */
+ if (get8(pp, desc_end) & 0x1) {
+ st->disposition |= AV_DISPOSITION_STILL_IMAGE;
+ }
+ break;
case 0x1E: /* SL descriptor */
desc_es_id = get16(pp, desc_end);
if (desc_es_id < 0)
diff --git a/libavformat/version.h b/libavformat/version.h
index 49e40e9494..e9b94cc216 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,8 +32,8 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 58
-#define LIBAVFORMAT_VERSION_MINOR 13
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MINOR 14
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \