]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpegts: tag video streams with still images
authorAman Gupta <aman@tmm1.net>
Tue, 15 May 2018 18:26:07 +0000 (11:26 -0700)
committerAman Gupta <aman@tmm1.net>
Thu, 17 May 2018 19:03:22 +0000 (12:03 -0700)
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>
doc/APIchanges
libavformat/avformat.h
libavformat/dump.c
libavformat/mpegts.c
libavformat/version.h

index bbefc8356e215af483cfd83386424d68858037f7..befa58c84a1b2f3761f6be48f8256c93b7a02ca3 100644 (file)
@@ -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.
 
index 669ddb423ee199ae3cf93b81926cadff1f9977fe..6dce88fad54e4ac67a31221e77b43e04be02a123 100644 (file)
@@ -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.
index 942e62a58194693c6873a17a9380f02ed049b988..bc0f401550a70f79b160262ffa714cee1462864a 100644 (file)
@@ -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, "    ");
index 9cc00c7eae68f6c07f92b9f85d2d354aaf4f01bb..fc9bb3940e6dea7ea30b3fb96fad8bbdddb7a3c7 100644 (file)
@@ -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)
index 49e40e9494204d7fc8166967fed018ae7947d314..e9b94cc216dfcf05ec1f9071eddc93a78ae261eb 100644 (file)
@@ -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, \