You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avformat/apvdec: add framerate option
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
committed by
James Almer
parent
59a6660625
commit
6e8bd5dd25
@ -16,6 +16,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/opt.h"
|
||||||
|
|
||||||
#include "libavcodec/apv.h"
|
#include "libavcodec/apv.h"
|
||||||
#include "libavcodec/bytestream.h"
|
#include "libavcodec/bytestream.h"
|
||||||
|
|
||||||
@ -24,6 +26,10 @@
|
|||||||
#include "demux.h"
|
#include "demux.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
typedef struct APVDemuxerContext {
|
||||||
|
const AVClass *class; /**< Class for private options. */
|
||||||
|
AVRational framerate; /**< AVRational describing framerate, set by a private option. */
|
||||||
|
} APVDemuxerContext;
|
||||||
|
|
||||||
typedef struct APVHeaderInfo {
|
typedef struct APVHeaderInfo {
|
||||||
uint8_t pbu_type;
|
uint8_t pbu_type;
|
||||||
@ -145,6 +151,7 @@ static int apv_probe(const AVProbeData *p)
|
|||||||
|
|
||||||
static int apv_read_header(AVFormatContext *s)
|
static int apv_read_header(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
|
APVDemuxerContext *apv = s->priv_data;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
GetByteContext gbc;
|
GetByteContext gbc;
|
||||||
uint8_t buffer[12];
|
uint8_t buffer[12];
|
||||||
@ -184,8 +191,8 @@ static int apv_read_header(AVFormatContext *s)
|
|||||||
st->codecpar->codec_id = AV_CODEC_ID_APV;
|
st->codecpar->codec_id = AV_CODEC_ID_APV;
|
||||||
|
|
||||||
ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS;
|
ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||||
st->avg_frame_rate = (AVRational){ 30, 1 };
|
st->avg_frame_rate = apv->framerate;
|
||||||
avpriv_set_pts_info(st, 64, 1, 30);
|
avpriv_set_pts_info(st, 64, apv->framerate.den, apv->framerate.num);
|
||||||
|
|
||||||
avio_seek(s->pb, -size, SEEK_CUR);
|
avio_seek(s->pb, -size, SEEK_CUR);
|
||||||
|
|
||||||
@ -221,11 +228,27 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define OFFSET(x) offsetof(APVDemuxerContext, x)
|
||||||
|
#define DEC AV_OPT_FLAG_DECODING_PARAM
|
||||||
|
static const AVOption apv_options[] = {
|
||||||
|
{ "framerate", "set frame rate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "30" }, 0, INT_MAX, DEC },
|
||||||
|
{ NULL },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const AVClass apv_demuxer_class = {
|
||||||
|
.class_name = "apv demuxer",
|
||||||
|
.item_name = av_default_item_name,
|
||||||
|
.option = apv_options,
|
||||||
|
.version = LIBAVUTIL_VERSION_INT,
|
||||||
|
};
|
||||||
|
|
||||||
const FFInputFormat ff_apv_demuxer = {
|
const FFInputFormat ff_apv_demuxer = {
|
||||||
.p.name = "apv",
|
.p.name = "apv",
|
||||||
.p.long_name = NULL_IF_CONFIG_SMALL("APV raw bitstream"),
|
.p.long_name = NULL_IF_CONFIG_SMALL("APV raw bitstream"),
|
||||||
.p.extensions = "apv",
|
.p.extensions = "apv",
|
||||||
.p.flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
|
.p.flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
|
||||||
|
.p.priv_class = &apv_demuxer_class,
|
||||||
|
.priv_data_size = sizeof(APVDemuxerContext),
|
||||||
.read_probe = apv_probe,
|
.read_probe = apv_probe,
|
||||||
.read_header = apv_read_header,
|
.read_header = apv_read_header,
|
||||||
.read_packet = apv_read_packet,
|
.read_packet = apv_read_packet,
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "version_major.h"
|
#include "version_major.h"
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_MINOR 1
|
#define LIBAVFORMAT_VERSION_MINOR 1
|
||||||
#define LIBAVFORMAT_VERSION_MICRO 100
|
#define LIBAVFORMAT_VERSION_MICRO 101
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||||
LIBAVFORMAT_VERSION_MINOR, \
|
LIBAVFORMAT_VERSION_MINOR, \
|
||||||
|
Reference in New Issue
Block a user