summaryrefslogtreecommitdiff
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-04-30 13:42:55 +0200
committerAnton Khirnov <anton@khirnov.net>2011-05-25 15:20:25 +0200
commit17a5556db598ba1e5550d89ae3e339c1161a218a (patch)
treedf5e58a02a975624da9e226a4ba5f2b7f9587e4d /libavformat/mpegts.c
parent5dc8214420e4c48cdf48455329138db752d15cd0 (diff)
mpegts: add compute_pcr option.
Deprecate the corresponding AVFormatParameters field.
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index e20d6966e3..20528c5bc4 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -25,6 +25,8 @@
#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
#include "mpegts.h"
@@ -86,6 +88,7 @@ struct Program {
};
struct MpegTSContext {
+ const AVClass *class;
/* user data */
AVFormatContext *stream;
/** raw packet size, including FEC if present */
@@ -122,6 +125,19 @@ struct MpegTSContext {
MpegTSFilter *pids[NB_PID_MAX];
};
+static const AVOption options[] = {
+ {"compute_pcr", "Compute exact PCR for each transport stream packet.", offsetof(MpegTSContext, mpeg2ts_compute_pcr), FF_OPT_TYPE_INT,
+ {.dbl = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+ { NULL },
+};
+
+static const AVClass mpegtsraw_class = {
+ .class_name = "mpegtsraw demuxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
/* TS stream handling */
enum MpegTSState {
@@ -1455,7 +1471,10 @@ static int mpegts_read_header(AVFormatContext *s,
int64_t pos;
if (ap) {
- ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr;
+#if FF_API_FORMAT_PARAMETERS
+ if (ap->mpeg2ts_compute_pcr)
+ ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr;
+#endif
if(ap->mpeg2ts_raw){
av_log(s, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n");
return -1;
@@ -1878,4 +1897,5 @@ AVInputFormat ff_mpegtsraw_demuxer = {
#ifdef USE_SYNCPOINT_SEARCH
.read_seek2 = read_seek2,
#endif
+ .priv_class = &mpegtsraw_class,
};