Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b7b61ff6a3 | ||
![]() |
7a6e47b99d | ||
![]() |
f84c349b3b | ||
![]() |
26f732e21d | ||
![]() |
82b2dd5ee4 | ||
![]() |
e82ddde05a | ||
![]() |
07f5da6128 | ||
![]() |
e845455225 | ||
![]() |
3fedb3e65c | ||
![]() |
1986380df2 | ||
![]() |
df3850db49 | ||
![]() |
082b4f8348 | ||
![]() |
788c313b50 | ||
![]() |
779d7610c7 | ||
![]() |
56629aa012 | ||
![]() |
33651e3edf | ||
![]() |
d46aada5c2 | ||
![]() |
66b1f210c0 | ||
![]() |
d4b98d475f | ||
![]() |
8d8962ca3e | ||
![]() |
329559ae50 | ||
![]() |
0b3a88fe15 | ||
![]() |
563fe360c3 | ||
![]() |
73a502dd43 | ||
![]() |
ea189b77eb | ||
![]() |
2ebd47841f | ||
![]() |
9d7244c4c6 | ||
![]() |
7aee089978 |
@@ -2,7 +2,7 @@ Release Notes
|
|||||||
=============
|
=============
|
||||||
|
|
||||||
* 0.8 "Love" June, 2011
|
* 0.8 "Love" June, 2011
|
||||||
* 0.7 "Peace" June, 2011 (identical to 0.8 but using 0.6 ABI/API)
|
* 0.7.1 "Peace" June, 2011 (identical to 0.8 but using 0.6 ABI/API)
|
||||||
|
|
||||||
|
|
||||||
General notes
|
General notes
|
||||||
|
@@ -479,7 +479,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* open the output file, if needed */
|
/* open the output file, if needed */
|
||||||
if (!(fmt->flags & AVFMT_NOFILE)) {
|
if (!(fmt->flags & AVFMT_NOFILE)) {
|
||||||
if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
|
if (avio_open(&oc->pb, filename, AVIO_WRONLY) < 0) {
|
||||||
fprintf(stderr, "Could not open '%s'\n", filename);
|
fprintf(stderr, "Could not open '%s'\n", filename);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
11
ffmpeg.c
11
ffmpeg.c
@@ -31,7 +31,7 @@
|
|||||||
#include "libavformat/avformat.h"
|
#include "libavformat/avformat.h"
|
||||||
#include "libavdevice/avdevice.h"
|
#include "libavdevice/avdevice.h"
|
||||||
#include "libswscale/swscale.h"
|
#include "libswscale/swscale.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavcodec/opt.h"
|
||||||
#include "libavcodec/audioconvert.h"
|
#include "libavcodec/audioconvert.h"
|
||||||
#include "libavutil/audioconvert.h"
|
#include "libavutil/audioconvert.h"
|
||||||
#include "libavutil/parseutils.h"
|
#include "libavutil/parseutils.h"
|
||||||
@@ -113,7 +113,9 @@ typedef struct AVChapterMap {
|
|||||||
static const OptionDef options[];
|
static const OptionDef options[];
|
||||||
|
|
||||||
#define MAX_FILES 100
|
#define MAX_FILES 100
|
||||||
|
#if !FF_API_MAX_STREAMS
|
||||||
#define MAX_STREAMS 1024 /* arbitrary sanity check value */
|
#define MAX_STREAMS 1024 /* arbitrary sanity check value */
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *last_asked_format = NULL;
|
static const char *last_asked_format = NULL;
|
||||||
static int64_t input_files_ts_offset[MAX_FILES];
|
static int64_t input_files_ts_offset[MAX_FILES];
|
||||||
@@ -711,7 +713,6 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename)
|
|||||||
return err;
|
return err;
|
||||||
/* copy stream format */
|
/* copy stream format */
|
||||||
s->nb_streams = 0;
|
s->nb_streams = 0;
|
||||||
s->streams = av_mallocz(sizeof(AVStream *) * ic->nb_streams);
|
|
||||||
for(i=0;i<ic->nb_streams;i++) {
|
for(i=0;i<ic->nb_streams;i++) {
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
AVCodec *codec;
|
AVCodec *codec;
|
||||||
@@ -3952,7 +3953,7 @@ static int opt_output_file(const char *opt, const char *filename)
|
|||||||
/* check filename in case of an image number is expected */
|
/* check filename in case of an image number is expected */
|
||||||
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
|
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
|
||||||
if (!av_filename_number_test(oc->filename)) {
|
if (!av_filename_number_test(oc->filename)) {
|
||||||
print_error(oc->filename, AVERROR(EINVAL));
|
print_error(oc->filename, AVERROR_NUMEXPECTED);
|
||||||
ffmpeg_exit(1);
|
ffmpeg_exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3963,7 +3964,7 @@ static int opt_output_file(const char *opt, const char *filename)
|
|||||||
(strchr(filename, ':') == NULL ||
|
(strchr(filename, ':') == NULL ||
|
||||||
filename[1] == ':' ||
|
filename[1] == ':' ||
|
||||||
av_strstart(filename, "file:", NULL))) {
|
av_strstart(filename, "file:", NULL))) {
|
||||||
if (avio_check(filename, 0) == 0) {
|
if (url_exist(filename)) {
|
||||||
if (!using_stdin) {
|
if (!using_stdin) {
|
||||||
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
|
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
@@ -3980,7 +3981,7 @@ static int opt_output_file(const char *opt, const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* open the file */
|
/* open the file */
|
||||||
if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {
|
if ((err = avio_open(&oc->pb, filename, AVIO_WRONLY)) < 0) {
|
||||||
print_error(filename, err);
|
print_error(filename, err);
|
||||||
ffmpeg_exit(1);
|
ffmpeg_exit(1);
|
||||||
}
|
}
|
||||||
|
34
ffplay.c
34
ffplay.c
@@ -27,6 +27,7 @@
|
|||||||
#include "libavutil/colorspace.h"
|
#include "libavutil/colorspace.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
#include "libavutil/imgutils.h"
|
#include "libavutil/imgutils.h"
|
||||||
|
#include "libavutil/dict.h"
|
||||||
#include "libavutil/parseutils.h"
|
#include "libavutil/parseutils.h"
|
||||||
#include "libavutil/samplefmt.h"
|
#include "libavutil/samplefmt.h"
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
@@ -34,7 +35,7 @@
|
|||||||
#include "libavdevice/avdevice.h"
|
#include "libavdevice/avdevice.h"
|
||||||
#include "libswscale/swscale.h"
|
#include "libswscale/swscale.h"
|
||||||
#include "libavcodec/audioconvert.h"
|
#include "libavcodec/audioconvert.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavcodec/opt.h"
|
||||||
#include "libavcodec/avfft.h"
|
#include "libavcodec/avfft.h"
|
||||||
|
|
||||||
#if CONFIG_AVFILTER
|
#if CONFIG_AVFILTER
|
||||||
@@ -2295,15 +2296,13 @@ static int decode_interrupt_cb(void)
|
|||||||
static int read_thread(void *arg)
|
static int read_thread(void *arg)
|
||||||
{
|
{
|
||||||
VideoState *is = arg;
|
VideoState *is = arg;
|
||||||
AVFormatContext *ic;
|
AVFormatContext *ic = NULL;
|
||||||
int err, i, ret;
|
int err, i, ret;
|
||||||
int st_index[AVMEDIA_TYPE_NB];
|
int st_index[AVMEDIA_TYPE_NB];
|
||||||
AVPacket pkt1, *pkt = &pkt1;
|
AVPacket pkt1, *pkt = &pkt1;
|
||||||
AVFormatParameters params, *ap = ¶ms;
|
|
||||||
int eof=0;
|
int eof=0;
|
||||||
int pkt_in_play_range = 0;
|
int pkt_in_play_range = 0;
|
||||||
|
AVDictionaryEntry *t;
|
||||||
ic = avformat_alloc_context();
|
|
||||||
|
|
||||||
memset(st_index, -1, sizeof(st_index));
|
memset(st_index, -1, sizeof(st_index));
|
||||||
is->video_stream = -1;
|
is->video_stream = -1;
|
||||||
@@ -2313,30 +2312,17 @@ static int read_thread(void *arg)
|
|||||||
global_video_state = is;
|
global_video_state = is;
|
||||||
avio_set_interrupt_cb(decode_interrupt_cb);
|
avio_set_interrupt_cb(decode_interrupt_cb);
|
||||||
|
|
||||||
memset(ap, 0, sizeof(*ap));
|
err = avformat_open_input(&ic, is->filename, is->iformat, &format_opts);
|
||||||
|
|
||||||
ap->prealloced_context = 1;
|
|
||||||
ap->width = frame_width;
|
|
||||||
ap->height= frame_height;
|
|
||||||
ap->time_base= (AVRational){1, 25};
|
|
||||||
ap->pix_fmt = frame_pix_fmt;
|
|
||||||
ic->flags |= AVFMT_FLAG_PRIV_OPT;
|
|
||||||
|
|
||||||
|
|
||||||
err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap);
|
|
||||||
if (err >= 0) {
|
|
||||||
set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL);
|
|
||||||
err = av_demuxer_open(ic, ap);
|
|
||||||
if(err < 0){
|
|
||||||
avformat_free_context(ic);
|
|
||||||
ic= NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
print_error(is->filename, err);
|
print_error(is->filename, err);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
|
||||||
|
ret = AVERROR_OPTION_NOT_FOUND;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
is->ic = ic;
|
is->ic = ic;
|
||||||
|
|
||||||
if(genpts)
|
if(genpts)
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "libavformat/avformat.h"
|
#include "libavformat/avformat.h"
|
||||||
#include "libavcodec/avcodec.h"
|
#include "libavcodec/avcodec.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavcodec/opt.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
#include "libavutil/dict.h"
|
#include "libavutil/dict.h"
|
||||||
#include "libavdevice/avdevice.h"
|
#include "libavdevice/avdevice.h"
|
||||||
|
42
ffserver.c
42
ffserver.c
@@ -39,7 +39,7 @@
|
|||||||
#include "libavutil/dict.h"
|
#include "libavutil/dict.h"
|
||||||
#include "libavutil/random_seed.h"
|
#include "libavutil/random_seed.h"
|
||||||
#include "libavutil/parseutils.h"
|
#include "libavutil/parseutils.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavcodec/opt.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -94,7 +94,9 @@ static const char *http_state[] = {
|
|||||||
"RTSP_SEND_PACKET",
|
"RTSP_SEND_PACKET",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !FF_API_MAX_STREAMS
|
||||||
#define MAX_STREAMS 20
|
#define MAX_STREAMS 20
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IOBUFFER_INIT_SIZE 8192
|
#define IOBUFFER_INIT_SIZE 8192
|
||||||
|
|
||||||
@@ -2229,11 +2231,11 @@ static int http_prepare_data(HTTPContext *c)
|
|||||||
av_dict_set(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0);
|
av_dict_set(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0);
|
||||||
av_dict_set(&c->fmt_ctx.metadata, "title" , c->stream->title , 0);
|
av_dict_set(&c->fmt_ctx.metadata, "title" , c->stream->title , 0);
|
||||||
|
|
||||||
c->fmt_ctx.streams = av_mallocz(sizeof(AVStream *) * c->stream->nb_streams);
|
|
||||||
|
|
||||||
for(i=0;i<c->stream->nb_streams;i++) {
|
for(i=0;i<c->stream->nb_streams;i++) {
|
||||||
|
AVStream *st;
|
||||||
AVStream *src;
|
AVStream *src;
|
||||||
c->fmt_ctx.streams[i] = av_mallocz(sizeof(AVStream));
|
st = av_mallocz(sizeof(AVStream));
|
||||||
|
c->fmt_ctx.streams[i] = st;
|
||||||
/* if file or feed, then just take streams from FFStream struct */
|
/* if file or feed, then just take streams from FFStream struct */
|
||||||
if (!c->stream->feed ||
|
if (!c->stream->feed ||
|
||||||
c->stream->feed == c->stream)
|
c->stream->feed == c->stream)
|
||||||
@@ -2241,9 +2243,9 @@ static int http_prepare_data(HTTPContext *c)
|
|||||||
else
|
else
|
||||||
src = c->stream->feed->streams[c->stream->feed_streams[i]];
|
src = c->stream->feed->streams[c->stream->feed_streams[i]];
|
||||||
|
|
||||||
*(c->fmt_ctx.streams[i]) = *src;
|
*st = *src;
|
||||||
c->fmt_ctx.streams[i]->priv_data = 0;
|
st->priv_data = 0;
|
||||||
c->fmt_ctx.streams[i]->codec->frame_number = 0; /* XXX: should be done in
|
st->codec->frame_number = 0; /* XXX: should be done in
|
||||||
AVStream, not in codec */
|
AVStream, not in codec */
|
||||||
}
|
}
|
||||||
/* set output format parameters */
|
/* set output format parameters */
|
||||||
@@ -2941,9 +2943,11 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
|
|||||||
snprintf(avc->filename, 1024, "rtp://0.0.0.0");
|
snprintf(avc->filename, 1024, "rtp://0.0.0.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !FF_API_MAX_STREAMS
|
||||||
if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
|
if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
|
||||||
!(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams))))
|
!(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams))))
|
||||||
goto sdp_done;
|
goto sdp_done;
|
||||||
|
#endif
|
||||||
if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
|
if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
|
||||||
!(avs = av_malloc(avc->nb_streams * sizeof(*avs))))
|
!(avs = av_malloc(avc->nb_streams * sizeof(*avs))))
|
||||||
goto sdp_done;
|
goto sdp_done;
|
||||||
@@ -2956,8 +2960,10 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
|
|||||||
av_sdp_create(&avc, 1, *pbuffer, 2048);
|
av_sdp_create(&avc, 1, *pbuffer, 2048);
|
||||||
|
|
||||||
sdp_done:
|
sdp_done:
|
||||||
|
#if !FF_API_MAX_STREAMS
|
||||||
av_free(avc->streams);
|
av_free(avc->streams);
|
||||||
av_dict_free(&avc->metadata);
|
#endif
|
||||||
|
av_metadata_free(&avc->metadata);
|
||||||
av_free(avc);
|
av_free(avc);
|
||||||
av_free(avs);
|
av_free(avs);
|
||||||
|
|
||||||
@@ -3385,9 +3391,6 @@ static int rtp_new_av_stream(HTTPContext *c,
|
|||||||
if (!st)
|
if (!st)
|
||||||
goto fail;
|
goto fail;
|
||||||
ctx->nb_streams = 1;
|
ctx->nb_streams = 1;
|
||||||
ctx->streams = av_mallocz(sizeof(AVStream *) * ctx->nb_streams);
|
|
||||||
if (!ctx->streams)
|
|
||||||
goto fail;
|
|
||||||
ctx->streams[0] = st;
|
ctx->streams[0] = st;
|
||||||
|
|
||||||
if (!c->stream->feed ||
|
if (!c->stream->feed ||
|
||||||
@@ -3421,7 +3424,7 @@ static int rtp_new_av_stream(HTTPContext *c,
|
|||||||
"rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
|
"rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url_open(&h, ctx->filename, AVIO_FLAG_WRITE) < 0)
|
if (url_open(&h, ctx->filename, AVIO_WRONLY) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
c->rtp_handles[stream_index] = h;
|
c->rtp_handles[stream_index] = h;
|
||||||
max_packet_size = url_get_max_packet_size(h);
|
max_packet_size = url_get_max_packet_size(h);
|
||||||
@@ -3674,7 +3677,7 @@ static void build_feed_streams(void)
|
|||||||
for(feed = first_feed; feed != NULL; feed = feed->next_feed) {
|
for(feed = first_feed; feed != NULL; feed = feed->next_feed) {
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) {
|
if (url_exist(feed->feed_filename)) {
|
||||||
/* See if it matches */
|
/* See if it matches */
|
||||||
AVFormatContext *s = NULL;
|
AVFormatContext *s = NULL;
|
||||||
int matches = 0;
|
int matches = 0;
|
||||||
@@ -3747,7 +3750,7 @@ static void build_feed_streams(void)
|
|||||||
unlink(feed->feed_filename);
|
unlink(feed->feed_filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (avio_check(feed->feed_filename, AVIO_FLAG_WRITE) <= 0) {
|
if (!url_exist(feed->feed_filename)) {
|
||||||
AVFormatContext s1 = {0}, *s = &s1;
|
AVFormatContext s1 = {0}, *s = &s1;
|
||||||
|
|
||||||
if (feed->readonly) {
|
if (feed->readonly) {
|
||||||
@@ -3757,15 +3760,20 @@ static void build_feed_streams(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* only write the header of the ffm file */
|
/* only write the header of the ffm file */
|
||||||
if (avio_open(&s->pb, feed->feed_filename, AVIO_FLAG_WRITE) < 0) {
|
if (avio_open(&s->pb, feed->feed_filename, AVIO_WRONLY) < 0) {
|
||||||
http_log("Could not open output feed file '%s'\n",
|
http_log("Could not open output feed file '%s'\n",
|
||||||
feed->feed_filename);
|
feed->feed_filename);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
s->oformat = feed->fmt;
|
s->oformat = feed->fmt;
|
||||||
s->nb_streams = feed->nb_streams;
|
s->nb_streams = feed->nb_streams;
|
||||||
s->streams = feed->streams;
|
for(i=0;i<s->nb_streams;i++) {
|
||||||
if (avformat_write_header(s, NULL) < 0) {
|
AVStream *st;
|
||||||
|
st = feed->streams[i];
|
||||||
|
s->streams[i] = st;
|
||||||
|
}
|
||||||
|
av_set_parameters(s, NULL);
|
||||||
|
if (av_write_header(s) < 0) {
|
||||||
http_log("Container doesn't supports the required parameters\n");
|
http_log("Container doesn't supports the required parameters\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@@ -50,8 +50,6 @@ typedef struct EightBpsContext {
|
|||||||
|
|
||||||
unsigned char planes;
|
unsigned char planes;
|
||||||
unsigned char planemap[4];
|
unsigned char planemap[4];
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} EightBpsContext;
|
} EightBpsContext;
|
||||||
|
|
||||||
|
|
||||||
@@ -131,16 +129,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->bits_per_coded_sample <= 8) {
|
if (avctx->palctrl) {
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt,
|
memcpy (c->pic.data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
AV_PKT_DATA_PALETTE,
|
if (avctx->palctrl->palette_changed) {
|
||||||
NULL);
|
|
||||||
if (pal) {
|
|
||||||
c->pic.palette_has_changed = 1;
|
c->pic.palette_has_changed = 1;
|
||||||
memcpy(c->pal, pal, AVPALETTE_SIZE);
|
avctx->palctrl->palette_changed = 0;
|
||||||
}
|
} else
|
||||||
|
c->pic.palette_has_changed = 0;
|
||||||
memcpy (c->pic.data[1], c->pal, AVPALETTE_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*data_size = sizeof(AVFrame);
|
*data_size = sizeof(AVFrame);
|
||||||
@@ -170,6 +165,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||||
c->planes = 1;
|
c->planes = 1;
|
||||||
c->planemap[0] = 0; // 1st plane is palette indexes
|
c->planemap[0] = 0; // 1st plane is palette indexes
|
||||||
|
if (avctx->palctrl == NULL) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Error: PAL8 format but no palette from demuxer.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
|
avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
|
||||||
|
@@ -15,6 +15,7 @@ OBJS = allcodecs.o \
|
|||||||
fmtconvert.o \
|
fmtconvert.o \
|
||||||
imgconvert.o \
|
imgconvert.o \
|
||||||
jrevdct.o \
|
jrevdct.o \
|
||||||
|
opt.o \
|
||||||
options.o \
|
options.o \
|
||||||
parser.o \
|
parser.o \
|
||||||
raw.o \
|
raw.o \
|
||||||
|
@@ -33,6 +33,12 @@
|
|||||||
|
|
||||||
#include "libavcodec/version.h"
|
#include "libavcodec/version.h"
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
# define FF_INTERNALC_MEM_TYPE unsigned int
|
||||||
|
#else
|
||||||
|
# define FF_INTERNALC_MEM_TYPE size_t
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identify the syntax and semantics of the bitstream.
|
* Identify the syntax and semantics of the bitstream.
|
||||||
* The principle is roughly:
|
* The principle is roughly:
|
||||||
@@ -111,6 +117,9 @@ enum CodecID {
|
|||||||
CODEC_ID_QDRAW,
|
CODEC_ID_QDRAW,
|
||||||
CODEC_ID_VIXL,
|
CODEC_ID_VIXL,
|
||||||
CODEC_ID_QPEG,
|
CODEC_ID_QPEG,
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
CODEC_ID_XVID,
|
||||||
|
#endif
|
||||||
CODEC_ID_PNG,
|
CODEC_ID_PNG,
|
||||||
CODEC_ID_PPM,
|
CODEC_ID_PPM,
|
||||||
CODEC_ID_PBM,
|
CODEC_ID_PBM,
|
||||||
@@ -359,6 +368,18 @@ enum CodecID {
|
|||||||
CODEC_ID_FFMETADATA=0x21000, ///< Dummy codec for streams containing only metadata information.
|
CODEC_ID_FFMETADATA=0x21000, ///< Dummy codec for streams containing only metadata information.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
#define CodecType AVMediaType
|
||||||
|
|
||||||
|
#define CODEC_TYPE_UNKNOWN AVMEDIA_TYPE_UNKNOWN
|
||||||
|
#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO
|
||||||
|
#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO
|
||||||
|
#define CODEC_TYPE_DATA AVMEDIA_TYPE_DATA
|
||||||
|
#define CODEC_TYPE_SUBTITLE AVMEDIA_TYPE_SUBTITLE
|
||||||
|
#define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT
|
||||||
|
#define CODEC_TYPE_NB AVMEDIA_TYPE_NB
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FF_API_OLD_SAMPLE_FMT
|
#if FF_API_OLD_SAMPLE_FMT
|
||||||
#define SampleFormat AVSampleFormat
|
#define SampleFormat AVSampleFormat
|
||||||
|
|
||||||
@@ -1070,10 +1091,6 @@ typedef struct AVPanScan{
|
|||||||
#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
|
#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
|
||||||
#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
|
#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
|
||||||
|
|
||||||
enum AVPacketSideDataType {
|
|
||||||
AV_PKT_DATA_PALETTE,
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct AVPacket {
|
typedef struct AVPacket {
|
||||||
/**
|
/**
|
||||||
* Presentation timestamp in AVStream->time_base units; the time at which
|
* Presentation timestamp in AVStream->time_base units; the time at which
|
||||||
@@ -1095,17 +1112,6 @@ typedef struct AVPacket {
|
|||||||
int size;
|
int size;
|
||||||
int stream_index;
|
int stream_index;
|
||||||
int flags;
|
int flags;
|
||||||
/**
|
|
||||||
* Additional packet data that can be provided by the container.
|
|
||||||
* Packet can contain several types of side information.
|
|
||||||
*/
|
|
||||||
struct {
|
|
||||||
uint8_t *data;
|
|
||||||
int size;
|
|
||||||
enum AVPacketSideDataType type;
|
|
||||||
} *side_data;
|
|
||||||
int side_data_elems;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duration of this packet in AVStream->time_base units, 0 if unknown.
|
* Duration of this packet in AVStream->time_base units, 0 if unknown.
|
||||||
* Equals next_pts - this_pts in presentation order.
|
* Equals next_pts - this_pts in presentation order.
|
||||||
@@ -1135,6 +1141,9 @@ typedef struct AVPacket {
|
|||||||
int64_t convergence_duration;
|
int64_t convergence_duration;
|
||||||
} AVPacket;
|
} AVPacket;
|
||||||
#define AV_PKT_FLAG_KEY 0x0001
|
#define AV_PKT_FLAG_KEY 0x0001
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Audio Video Frame.
|
* Audio Video Frame.
|
||||||
@@ -1255,6 +1264,16 @@ typedef struct AVCodecContext {
|
|||||||
*/
|
*/
|
||||||
enum PixelFormat pix_fmt;
|
enum PixelFormat pix_fmt;
|
||||||
|
|
||||||
|
#if FF_API_RATE_EMU
|
||||||
|
/**
|
||||||
|
* Frame rate emulation. If not zero, the lower layer (i.e. format handler)
|
||||||
|
* has to read frames at native frame rate.
|
||||||
|
* - encoding: Set by user.
|
||||||
|
* - decoding: unused
|
||||||
|
*/
|
||||||
|
attribute_deprecated int rate_emu;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If non NULL, 'draw_horiz_band' is called by the libavcodec
|
* If non NULL, 'draw_horiz_band' is called by the libavcodec
|
||||||
* decoder to draw a horizontal band. It improves cache usage. Not
|
* decoder to draw a horizontal band. It improves cache usage. Not
|
||||||
@@ -1299,6 +1318,9 @@ typedef struct AVCodecContext {
|
|||||||
*/
|
*/
|
||||||
int frame_size;
|
int frame_size;
|
||||||
int frame_number; ///< audio or video frame number
|
int frame_number; ///< audio or video frame number
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
int real_pict_num; ///< Returns the real picture number of previous encoded frame.
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of frames the decoded output will be delayed relative to
|
* Number of frames the decoded output will be delayed relative to
|
||||||
@@ -1356,6 +1378,16 @@ typedef struct AVCodecContext {
|
|||||||
|
|
||||||
int b_frame_strategy;
|
int b_frame_strategy;
|
||||||
|
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/**
|
||||||
|
* hurry up amount
|
||||||
|
* - encoding: unused
|
||||||
|
* - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
|
||||||
|
* @deprecated Deprecated in favor of skip_idct and skip_frame.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int hurry_up;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct AVCodec *codec;
|
struct AVCodec *codec;
|
||||||
|
|
||||||
void *priv_data;
|
void *priv_data;
|
||||||
@@ -1473,6 +1505,9 @@ typedef struct AVCodecContext {
|
|||||||
#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
|
#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
|
||||||
#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
|
#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
|
||||||
#define FF_COMPLIANCE_NORMAL 0
|
#define FF_COMPLIANCE_NORMAL 0
|
||||||
|
#if FF_API_INOFFICIAL
|
||||||
|
#define FF_COMPLIANCE_INOFFICIAL -1 ///< Allow inofficial extensions (deprecated - use FF_COMPLIANCE_UNOFFICIAL instead).
|
||||||
|
#endif
|
||||||
#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
|
#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
|
||||||
#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
|
#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
|
||||||
|
|
||||||
@@ -1746,6 +1781,25 @@ typedef struct AVCodecContext {
|
|||||||
*/
|
*/
|
||||||
unsigned dsp_mask;
|
unsigned dsp_mask;
|
||||||
|
|
||||||
|
#if FF_API_MM_FLAGS
|
||||||
|
#define FF_MM_FORCE AV_CPU_FLAG_FORCE
|
||||||
|
#define FF_MM_MMX AV_CPU_FLAG_MMX
|
||||||
|
#define FF_MM_3DNOW AV_CPU_FLAG_3DNOW
|
||||||
|
#define FF_MM_MMXEXT AV_CPU_FLAG_MMX2
|
||||||
|
#define FF_MM_MMX2 AV_CPU_FLAG_MMX2
|
||||||
|
#define FF_MM_SSE AV_CPU_FLAG_SSE
|
||||||
|
#define FF_MM_SSE2 AV_CPU_FLAG_SSE2
|
||||||
|
#define FF_MM_SSE2SLOW AV_CPU_FLAG_SSE2SLOW
|
||||||
|
#define FF_MM_3DNOWEXT AV_CPU_FLAG_3DNOWEXT
|
||||||
|
#define FF_MM_SSE3 AV_CPU_FLAG_SSE3
|
||||||
|
#define FF_MM_SSE3SLOW AV_CPU_FLAG_SSE3SLOW
|
||||||
|
#define FF_MM_SSSE3 AV_CPU_FLAG_SSSE3
|
||||||
|
#define FF_MM_SSE4 AV_CPU_FLAG_SSE4
|
||||||
|
#define FF_MM_SSE42 AV_CPU_FLAG_SSE42
|
||||||
|
#define FF_MM_IWMMXT AV_CPU_FLAG_IWMMXT
|
||||||
|
#define FF_MM_ALTIVEC AV_CPU_FLAG_ALTIVEC
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bits per sample/pixel from the demuxer (needed for huffyuv).
|
* bits per sample/pixel from the demuxer (needed for huffyuv).
|
||||||
* - encoding: Set by libavcodec.
|
* - encoding: Set by libavcodec.
|
||||||
@@ -1820,6 +1874,22 @@ typedef struct AVCodecContext {
|
|||||||
*/
|
*/
|
||||||
uint64_t error[4];
|
uint64_t error[4];
|
||||||
|
|
||||||
|
#if FF_API_MB_Q
|
||||||
|
/**
|
||||||
|
* minimum MB quantizer
|
||||||
|
* - encoding: unused
|
||||||
|
* - decoding: unused
|
||||||
|
*/
|
||||||
|
attribute_deprecated int mb_qmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* maximum MB quantizer
|
||||||
|
* - encoding: unused
|
||||||
|
* - decoding: unused
|
||||||
|
*/
|
||||||
|
attribute_deprecated int mb_qmax;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* motion estimation comparison function
|
* motion estimation comparison function
|
||||||
* - encoding: Set by user.
|
* - encoding: Set by user.
|
||||||
@@ -2521,6 +2591,23 @@ typedef struct AVCodecContext {
|
|||||||
int compression_level;
|
int compression_level;
|
||||||
#define FF_COMPRESSION_DEFAULT -1
|
#define FF_COMPRESSION_DEFAULT -1
|
||||||
|
|
||||||
|
#if FF_API_USE_LPC
|
||||||
|
/**
|
||||||
|
* Sets whether to use LPC mode - used by FLAC encoder.
|
||||||
|
* - encoding: Set by user.
|
||||||
|
* - decoding: unused
|
||||||
|
* @deprecated Deprecated in favor of lpc_type and lpc_passes.
|
||||||
|
*/
|
||||||
|
int use_lpc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LPC coefficient precision - used by FLAC encoder
|
||||||
|
* - encoding: Set by user.
|
||||||
|
* - decoding: unused
|
||||||
|
*/
|
||||||
|
int lpc_coeff_precision;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* - encoding: Set by user.
|
* - encoding: Set by user.
|
||||||
* - decoding: unused
|
* - decoding: unused
|
||||||
@@ -2540,13 +2627,6 @@ typedef struct AVCodecContext {
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* LPC coefficient precision - used by FLAC encoder
|
|
||||||
* - encoding: Set by user.
|
|
||||||
* - decoding: unused
|
|
||||||
*/
|
|
||||||
attribute_deprecated int lpc_coeff_precision;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* search method for selecting prediction order
|
* search method for selecting prediction order
|
||||||
* - encoding: Set by user.
|
* - encoding: Set by user.
|
||||||
@@ -3211,33 +3291,6 @@ int av_dup_packet(AVPacket *pkt);
|
|||||||
*/
|
*/
|
||||||
void av_free_packet(AVPacket *pkt);
|
void av_free_packet(AVPacket *pkt);
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate new information of a packet.
|
|
||||||
*
|
|
||||||
* @param pkt packet
|
|
||||||
* @param type side information type
|
|
||||||
* @param size side information size
|
|
||||||
* @return pointer to fresh allocated data or NULL otherwise
|
|
||||||
*/
|
|
||||||
uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
|
||||||
int size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get side information from packet.
|
|
||||||
*
|
|
||||||
* @param pkt packet
|
|
||||||
* @param type desired side information type
|
|
||||||
* @param size pointer for side information size to store (optional)
|
|
||||||
* @return pointer to data if present or NULL otherwise
|
|
||||||
*/
|
|
||||||
uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
|
||||||
int *size);
|
|
||||||
|
|
||||||
int av_packet_merge_side_data(AVPacket *pkt);
|
|
||||||
|
|
||||||
int av_packet_split_side_data(AVPacket *pkt);
|
|
||||||
|
|
||||||
|
|
||||||
/* resample.c */
|
/* resample.c */
|
||||||
|
|
||||||
struct ReSampleContext;
|
struct ReSampleContext;
|
||||||
@@ -3245,6 +3298,14 @@ struct AVResampleContext;
|
|||||||
|
|
||||||
typedef struct ReSampleContext ReSampleContext;
|
typedef struct ReSampleContext ReSampleContext;
|
||||||
|
|
||||||
|
#if FF_API_AUDIO_OLD
|
||||||
|
/**
|
||||||
|
* @deprecated Use av_audio_resample_init() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels,
|
||||||
|
int output_rate, int input_rate);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize audio resampling context.
|
* Initialize audio resampling context.
|
||||||
*
|
*
|
||||||
@@ -3408,6 +3469,23 @@ const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
|
|||||||
|
|
||||||
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
|
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
/**
|
||||||
|
* Return the pixel format corresponding to the name name.
|
||||||
|
*
|
||||||
|
* If there is no pixel format with name name, then look for a
|
||||||
|
* pixel format with the name corresponding to the native endian
|
||||||
|
* format of name.
|
||||||
|
* For example in a little-endian system, first look for "gray16",
|
||||||
|
* then for "gray16le".
|
||||||
|
*
|
||||||
|
* Finally if no pixel format has been found, return PIX_FMT_NONE.
|
||||||
|
*
|
||||||
|
* @deprecated Deprecated in favor of av_get_pix_fmt().
|
||||||
|
*/
|
||||||
|
attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a value representing the fourCC code associated to the
|
* Return a value representing the fourCC code associated to the
|
||||||
* pixel format pix_fmt, or 0 if no associated fourCC code can be
|
* pixel format pix_fmt, or 0 if no associated fourCC code can be
|
||||||
@@ -3476,6 +3554,14 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_
|
|||||||
enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
|
enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
|
||||||
int has_alpha, int *loss_ptr);
|
int has_alpha, int *loss_ptr);
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
/**
|
||||||
|
* @deprecated Use av_get_pix_fmt_string() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated
|
||||||
|
void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
|
#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
|
||||||
#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
|
#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
|
||||||
|
|
||||||
@@ -3526,6 +3612,13 @@ const char *avcodec_license(void);
|
|||||||
*/
|
*/
|
||||||
void avcodec_init(void);
|
void avcodec_init(void);
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
/**
|
||||||
|
* @deprecated Deprecated in favor of avcodec_register().
|
||||||
|
*/
|
||||||
|
attribute_deprecated void register_avcodec(AVCodec *codec);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the codec codec and initialize libavcodec.
|
* Register the codec codec and initialize libavcodec.
|
||||||
*
|
*
|
||||||
@@ -3670,6 +3763,14 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
|
|||||||
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||||
int linesize_align[4]);
|
int linesize_align[4]);
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
/**
|
||||||
|
* @deprecated Deprecated in favor of av_check_image_size().
|
||||||
|
*/
|
||||||
|
attribute_deprecated
|
||||||
|
int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h);
|
||||||
|
#endif
|
||||||
|
|
||||||
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
|
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
|
||||||
|
|
||||||
#if FF_API_THREAD_INIT
|
#if FF_API_THREAD_INIT
|
||||||
@@ -3678,8 +3779,8 @@ enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum
|
|||||||
*/
|
*/
|
||||||
attribute_deprecated
|
attribute_deprecated
|
||||||
int avcodec_thread_init(AVCodecContext *s, int thread_count);
|
int avcodec_thread_init(AVCodecContext *s, int thread_count);
|
||||||
|
void avcodec_thread_free(AVCodecContext *s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
|
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
|
||||||
int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
|
int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
|
||||||
//FIXME func typedef
|
//FIXME func typedef
|
||||||
@@ -3713,6 +3814,25 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2,
|
|||||||
*/
|
*/
|
||||||
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
|
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
|
||||||
|
|
||||||
|
#if FF_API_AUDIO_OLD
|
||||||
|
/**
|
||||||
|
* Decode an audio frame from buf into samples.
|
||||||
|
* Wrapper function which calls avcodec_decode_audio3.
|
||||||
|
*
|
||||||
|
* @deprecated Use avcodec_decode_audio3 instead.
|
||||||
|
* @param avctx the codec context
|
||||||
|
* @param[out] samples the output buffer
|
||||||
|
* @param[in,out] frame_size_ptr the output buffer size in bytes
|
||||||
|
* @param[in] buf the input buffer
|
||||||
|
* @param[in] buf_size the input buffer size in bytes
|
||||||
|
* @return On error a negative value is returned, otherwise the number of bytes
|
||||||
|
* used or zero if no frame could be decompressed.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
|
||||||
|
int *frame_size_ptr,
|
||||||
|
const uint8_t *buf, int buf_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode the audio frame of size avpkt->size from avpkt->data into samples.
|
* Decode the audio frame of size avpkt->size from avpkt->data into samples.
|
||||||
* Some decoders may support multiple frames in a single AVPacket, such
|
* Some decoders may support multiple frames in a single AVPacket, such
|
||||||
@@ -3756,6 +3876,25 @@ int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
|
|||||||
int *frame_size_ptr,
|
int *frame_size_ptr,
|
||||||
AVPacket *avpkt);
|
AVPacket *avpkt);
|
||||||
|
|
||||||
|
#if FF_API_VIDEO_OLD
|
||||||
|
/**
|
||||||
|
* Decode a video frame from buf into picture.
|
||||||
|
* Wrapper function which calls avcodec_decode_video2.
|
||||||
|
*
|
||||||
|
* @deprecated Use avcodec_decode_video2 instead.
|
||||||
|
* @param avctx the codec context
|
||||||
|
* @param[out] picture The AVFrame in which the decoded video frame will be stored.
|
||||||
|
* @param[in] buf the input buffer
|
||||||
|
* @param[in] buf_size the size of the input buffer in bytes
|
||||||
|
* @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
|
||||||
|
* @return On error a negative value is returned, otherwise the number of bytes
|
||||||
|
* used or zero if no frame could be decompressed.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
|
||||||
|
int *got_picture_ptr,
|
||||||
|
const uint8_t *buf, int buf_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode the video frame of size avpkt->size from avpkt->data into picture.
|
* Decode the video frame of size avpkt->size from avpkt->data into picture.
|
||||||
* Some decoders may support multiple frames in a single AVPacket, such
|
* Some decoders may support multiple frames in a single AVPacket, such
|
||||||
@@ -3800,6 +3939,15 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
|
|||||||
int *got_picture_ptr,
|
int *got_picture_ptr,
|
||||||
AVPacket *avpkt);
|
AVPacket *avpkt);
|
||||||
|
|
||||||
|
#if FF_API_SUBTITLE_OLD
|
||||||
|
/* Decode a subtitle message. Return -1 if error, otherwise return the
|
||||||
|
* number of bytes used. If no subtitle could be decompressed,
|
||||||
|
* got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */
|
||||||
|
attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
|
||||||
|
int *got_sub_ptr,
|
||||||
|
const uint8_t *buf, int buf_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode a subtitle message.
|
* Decode a subtitle message.
|
||||||
* Return a negative value on error, otherwise return the number of bytes used.
|
* Return a negative value on error, otherwise return the number of bytes used.
|
||||||
@@ -4068,6 +4216,15 @@ AVCodecParser *av_parser_next(AVCodecParser *c);
|
|||||||
void av_register_codec_parser(AVCodecParser *parser);
|
void av_register_codec_parser(AVCodecParser *parser);
|
||||||
AVCodecParserContext *av_parser_init(int codec_id);
|
AVCodecParserContext *av_parser_init(int codec_id);
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
attribute_deprecated
|
||||||
|
int av_parser_parse(AVCodecParserContext *s,
|
||||||
|
AVCodecContext *avctx,
|
||||||
|
uint8_t **poutbuf, int *poutbuf_size,
|
||||||
|
const uint8_t *buf, int buf_size,
|
||||||
|
int64_t pts, int64_t dts);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a packet.
|
* Parse a packet.
|
||||||
*
|
*
|
||||||
@@ -4146,7 +4303,7 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
|
|||||||
*
|
*
|
||||||
* @see av_realloc
|
* @see av_realloc
|
||||||
*/
|
*/
|
||||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a buffer, reusing the given one if large enough.
|
* Allocate a buffer, reusing the given one if large enough.
|
||||||
@@ -4160,7 +4317,17 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
|||||||
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
||||||
* *size 0 if an error occurred.
|
* *size 0 if an error occurred.
|
||||||
*/
|
*/
|
||||||
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size);
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
/**
|
||||||
|
* @deprecated Deprecated in favor of av_image_copy().
|
||||||
|
*/
|
||||||
|
attribute_deprecated
|
||||||
|
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
|
||||||
|
uint8_t *src_data[4], int src_linesize[4],
|
||||||
|
enum PixelFormat pix_fmt, int width, int height);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy image src to dst. Wraps av_picture_data_copy() above.
|
* Copy image src to dst. Wraps av_picture_data_copy() above.
|
||||||
@@ -4189,6 +4356,22 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
|
|||||||
*/
|
*/
|
||||||
unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
|
unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
/**
|
||||||
|
* Parse str and put in width_ptr and height_ptr the detected values.
|
||||||
|
*
|
||||||
|
* @deprecated Deprecated in favor of av_parse_video_size().
|
||||||
|
*/
|
||||||
|
attribute_deprecated int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse str and store the detected values in *frame_rate.
|
||||||
|
*
|
||||||
|
* @deprecated Deprecated in favor of av_parse_video_rate().
|
||||||
|
*/
|
||||||
|
attribute_deprecated int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a generic warning message about a missing feature. This function is
|
* Logs a generic warning message about a missing feature. This function is
|
||||||
* intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
|
* intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
|
||||||
|
@@ -26,21 +26,12 @@
|
|||||||
void av_destruct_packet_nofree(AVPacket *pkt)
|
void av_destruct_packet_nofree(AVPacket *pkt)
|
||||||
{
|
{
|
||||||
pkt->data = NULL; pkt->size = 0;
|
pkt->data = NULL; pkt->size = 0;
|
||||||
pkt->side_data = NULL;
|
|
||||||
pkt->side_data_elems = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_destruct_packet(AVPacket *pkt)
|
void av_destruct_packet(AVPacket *pkt)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
av_free(pkt->data);
|
av_free(pkt->data);
|
||||||
pkt->data = NULL; pkt->size = 0;
|
pkt->data = NULL; pkt->size = 0;
|
||||||
|
|
||||||
for (i = 0; i < pkt->side_data_elems; i++)
|
|
||||||
av_free(pkt->side_data[i].data);
|
|
||||||
av_freep(&pkt->side_data);
|
|
||||||
pkt->side_data_elems = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_init_packet(AVPacket *pkt)
|
void av_init_packet(AVPacket *pkt)
|
||||||
@@ -53,8 +44,6 @@ void av_init_packet(AVPacket *pkt)
|
|||||||
pkt->flags = 0;
|
pkt->flags = 0;
|
||||||
pkt->stream_index = 0;
|
pkt->stream_index = 0;
|
||||||
pkt->destruct= NULL;
|
pkt->destruct= NULL;
|
||||||
pkt->side_data = NULL;
|
|
||||||
pkt->side_data_elems = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int av_new_packet(AVPacket *pkt, int size)
|
int av_new_packet(AVPacket *pkt, int size)
|
||||||
@@ -100,52 +89,23 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DUP_DATA(dst, src, size, padding) \
|
|
||||||
do { \
|
|
||||||
void *data; \
|
|
||||||
if (padding) { \
|
|
||||||
if ((unsigned)(size) > (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \
|
|
||||||
goto failed_alloc; \
|
|
||||||
data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \
|
|
||||||
} else { \
|
|
||||||
data = av_malloc(size); \
|
|
||||||
} \
|
|
||||||
if (!data) \
|
|
||||||
goto failed_alloc; \
|
|
||||||
memcpy(data, src, size); \
|
|
||||||
if (padding) \
|
|
||||||
memset((uint8_t*)data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); \
|
|
||||||
dst = data; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
int av_dup_packet(AVPacket *pkt)
|
int av_dup_packet(AVPacket *pkt)
|
||||||
{
|
{
|
||||||
AVPacket tmp_pkt;
|
|
||||||
|
|
||||||
if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
|
if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
|
||||||
tmp_pkt = *pkt;
|
uint8_t *data;
|
||||||
|
/* We duplicate the packet and don't forget to add the padding again. */
|
||||||
pkt->data = NULL;
|
if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE)
|
||||||
pkt->side_data = NULL;
|
return AVERROR(ENOMEM);
|
||||||
DUP_DATA(pkt->data, tmp_pkt.data, pkt->size, 1);
|
data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
pkt->destruct = av_destruct_packet;
|
if (!data) {
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
if (pkt->side_data_elems) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
DUP_DATA(pkt->side_data, tmp_pkt.side_data,
|
|
||||||
pkt->side_data_elems * sizeof(*pkt->side_data), 0);
|
|
||||||
memset(pkt->side_data, 0, pkt->side_data_elems * sizeof(*pkt->side_data));
|
|
||||||
for (i = 0; i < pkt->side_data_elems; i++) {
|
|
||||||
DUP_DATA(pkt->side_data[i].data, tmp_pkt.side_data[i].data,
|
|
||||||
pkt->side_data[i].size, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
memcpy(data, pkt->data, pkt->size);
|
||||||
|
memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
|
pkt->data = data;
|
||||||
|
pkt->destruct = av_destruct_packet;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
failed_alloc:
|
|
||||||
av_destruct_packet(pkt);
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_free_packet(AVPacket *pkt)
|
void av_free_packet(AVPacket *pkt)
|
||||||
@@ -153,125 +113,6 @@ void av_free_packet(AVPacket *pkt)
|
|||||||
if (pkt) {
|
if (pkt) {
|
||||||
if (pkt->destruct) pkt->destruct(pkt);
|
if (pkt->destruct) pkt->destruct(pkt);
|
||||||
pkt->data = NULL; pkt->size = 0;
|
pkt->data = NULL; pkt->size = 0;
|
||||||
pkt->side_data = NULL;
|
|
||||||
pkt->side_data_elems = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
|
||||||
int size)
|
|
||||||
{
|
|
||||||
int elems = pkt->side_data_elems;
|
|
||||||
|
|
||||||
if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
|
|
||||||
return NULL;
|
|
||||||
if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data));
|
|
||||||
if (!pkt->side_data)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
pkt->side_data[elems].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
if (!pkt->side_data[elems].data)
|
|
||||||
return NULL;
|
|
||||||
pkt->side_data[elems].size = size;
|
|
||||||
pkt->side_data[elems].type = type;
|
|
||||||
pkt->side_data_elems++;
|
|
||||||
|
|
||||||
return pkt->side_data[elems].data;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
|
||||||
int *size)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < pkt->side_data_elems; i++) {
|
|
||||||
if (pkt->side_data[i].type == type) {
|
|
||||||
if (size)
|
|
||||||
*size = pkt->side_data[i].size;
|
|
||||||
return pkt->side_data[i].data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FF_MERGE_MARKER 0x8c4d9d108e25e9feULL
|
|
||||||
|
|
||||||
int av_packet_merge_side_data(AVPacket *pkt){
|
|
||||||
if(pkt->side_data_elems){
|
|
||||||
int i;
|
|
||||||
uint8_t *p;
|
|
||||||
uint64_t size= pkt->size + 8LL + FF_INPUT_BUFFER_PADDING_SIZE;
|
|
||||||
AVPacket old= *pkt;
|
|
||||||
for (i=0; i<old.side_data_elems; i++) {
|
|
||||||
size += old.side_data[i].size + 5LL;
|
|
||||||
}
|
|
||||||
if (size > INT_MAX)
|
|
||||||
return AVERROR(EINVAL);
|
|
||||||
p = av_malloc(size);
|
|
||||||
if (!p)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
pkt->data = p;
|
|
||||||
pkt->destruct = av_destruct_packet;
|
|
||||||
pkt->size = size - FF_INPUT_BUFFER_PADDING_SIZE;
|
|
||||||
bytestream_put_buffer(&p, old.data, old.size);
|
|
||||||
for (i=old.side_data_elems-1; i>=0; i--) {
|
|
||||||
bytestream_put_buffer(&p, old.side_data[i].data, old.side_data[i].size);
|
|
||||||
bytestream_put_be32(&p, old.side_data[i].size);
|
|
||||||
*p++ = old.side_data[i].type | ((i==old.side_data_elems-1)*128);
|
|
||||||
}
|
|
||||||
bytestream_put_be64(&p, FF_MERGE_MARKER);
|
|
||||||
av_assert0(p-pkt->data == pkt->size);
|
|
||||||
memset(p, 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
av_free_packet(&old);
|
|
||||||
pkt->side_data_elems = 0;
|
|
||||||
pkt->side_data = NULL;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int av_packet_split_side_data(AVPacket *pkt){
|
|
||||||
if (!pkt->side_data_elems && pkt->size >12 && AV_RB64(pkt->data + pkt->size - 8) == FF_MERGE_MARKER){
|
|
||||||
int i;
|
|
||||||
unsigned int size;
|
|
||||||
uint8_t *p= pkt->data + pkt->size - 8 - 5;
|
|
||||||
|
|
||||||
av_dup_packet(pkt);
|
|
||||||
|
|
||||||
for (i=1; ; i++){
|
|
||||||
size = AV_RB32(p);
|
|
||||||
if (size>INT_MAX || p - pkt->data <= size)
|
|
||||||
return 0;
|
|
||||||
if (p[4]&128)
|
|
||||||
break;
|
|
||||||
p-= size+5;
|
|
||||||
}
|
|
||||||
|
|
||||||
pkt->side_data = av_malloc(i * sizeof(*pkt->side_data));
|
|
||||||
if (!pkt->side_data)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
|
|
||||||
p= pkt->data + pkt->size - 8 - 5;
|
|
||||||
for (i=0; ; i++){
|
|
||||||
size= AV_RB32(p);
|
|
||||||
av_assert0(size<=INT_MAX && p - pkt->data > size);
|
|
||||||
pkt->side_data[i].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
pkt->side_data[i].size = size;
|
|
||||||
pkt->side_data[i].type = p[4]&127;
|
|
||||||
if (!pkt->side_data[i].data)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
memcpy(pkt->side_data[i].data, p-size, size);
|
|
||||||
pkt->size -= size + 5;
|
|
||||||
if(p[4]&128)
|
|
||||||
break;
|
|
||||||
p-= size+5;
|
|
||||||
}
|
|
||||||
pkt->size -= 8;
|
|
||||||
pkt->side_data_elems = i+1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -67,7 +67,6 @@ typedef struct CinepakContext {
|
|||||||
|
|
||||||
int sega_film_skip_bytes;
|
int sega_film_skip_bytes;
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} CinepakContext;
|
} CinepakContext;
|
||||||
|
|
||||||
static void cinepak_decode_codebook (cvid_codebook *codebook,
|
static void cinepak_decode_codebook (cvid_codebook *codebook,
|
||||||
@@ -396,7 +395,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
|
|||||||
s->sega_film_skip_bytes = -1; /* uninitialized state */
|
s->sega_film_skip_bytes = -1; /* uninitialized state */
|
||||||
|
|
||||||
// check for paletted data
|
// check for paletted data
|
||||||
if (avctx->bits_per_coded_sample != 8) {
|
if ((avctx->palctrl == NULL) || (avctx->bits_per_coded_sample == 40)) {
|
||||||
s->palette_video = 0;
|
s->palette_video = 0;
|
||||||
avctx->pix_fmt = PIX_FMT_YUV420P;
|
avctx->pix_fmt = PIX_FMT_YUV420P;
|
||||||
} else {
|
} else {
|
||||||
@@ -429,18 +428,16 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->palette_video) {
|
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
|
||||||
if (pal) {
|
|
||||||
s->frame.palette_has_changed = 1;
|
|
||||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cinepak_decode(s);
|
cinepak_decode(s);
|
||||||
|
|
||||||
if (s->palette_video)
|
if (s->palette_video) {
|
||||||
memcpy (s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
memcpy (s->frame.data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
if (avctx->palctrl->palette_changed) {
|
||||||
|
s->frame.palette_has_changed = 1;
|
||||||
|
avctx->palctrl->palette_changed = 0;
|
||||||
|
} else
|
||||||
|
s->frame.palette_has_changed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
*data_size = sizeof(AVFrame);
|
*data_size = sizeof(AVFrame);
|
||||||
*(AVFrame*)data = s->frame;
|
*(AVFrame*)data = s->frame;
|
||||||
|
@@ -120,6 +120,14 @@ void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
|
|||||||
void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
|
void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
|
||||||
|
|
||||||
/* 1/2^n downscaling functions from imgconvert.c */
|
/* 1/2^n downscaling functions from imgconvert.c */
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
/**
|
||||||
|
* @deprecated Use av_image_copy_plane() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated
|
||||||
|
void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
||||||
|
#endif
|
||||||
|
|
||||||
void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
||||||
void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
||||||
void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
|
||||||
|
@@ -296,6 +296,17 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
|||||||
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
|
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
|
||||||
|
|
||||||
/* set compression option overrides from AVCodecContext */
|
/* set compression option overrides from AVCodecContext */
|
||||||
|
#if FF_API_USE_LPC
|
||||||
|
/* for compatibility with deprecated AVCodecContext.use_lpc */
|
||||||
|
if (avctx->use_lpc == 0) {
|
||||||
|
s->options.lpc_type = AV_LPC_TYPE_FIXED;
|
||||||
|
} else if (avctx->use_lpc == 1) {
|
||||||
|
s->options.lpc_type = AV_LPC_TYPE_LEVINSON;
|
||||||
|
} else if (avctx->use_lpc > 1) {
|
||||||
|
s->options.lpc_type = AV_LPC_TYPE_CHOLESKY;
|
||||||
|
s->options.lpc_passes = avctx->use_lpc - 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if FF_API_FLAC_GLOBAL_OPTS
|
#if FF_API_FLAC_GLOBAL_OPTS
|
||||||
if (avctx->lpc_type > FF_LPC_TYPE_DEFAULT) {
|
if (avctx->lpc_type > FF_LPC_TYPE_DEFAULT) {
|
||||||
if (avctx->lpc_type > FF_LPC_TYPE_CHOLESKY) {
|
if (avctx->lpc_type > FF_LPC_TYPE_CHOLESKY) {
|
||||||
|
@@ -599,6 +599,10 @@ retry:
|
|||||||
s->current_picture.pict_type= s->pict_type;
|
s->current_picture.pict_type= s->pict_type;
|
||||||
s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
|
s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
|
||||||
|
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* skip everything if we are in a hurry>=5 */
|
||||||
|
if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
|
||||||
|
#endif
|
||||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||||
|
@@ -598,10 +598,18 @@ retry:
|
|||||||
|
|
||||||
/* skip B-frames if we don't have reference frames */
|
/* skip B-frames if we don't have reference frames */
|
||||||
if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)) return get_consumed_bytes(s, buf_size);
|
if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)) return get_consumed_bytes(s, buf_size);
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* skip b frames if we are in a hurry */
|
||||||
|
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
|
||||||
|
#endif
|
||||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||||
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||||
return get_consumed_bytes(s, buf_size);
|
return get_consumed_bytes(s, buf_size);
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* skip everything if we are in a hurry>=5 */
|
||||||
|
if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(s->next_p_frame_damaged){
|
if(s->next_p_frame_damaged){
|
||||||
if(s->pict_type==AV_PICTURE_TYPE_B)
|
if(s->pict_type==AV_PICTURE_TYPE_B)
|
||||||
|
@@ -3303,8 +3303,8 @@ static void loop_filter(H264Context *h, int start_x, int end_x){
|
|||||||
uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
|
uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
|
||||||
if(mb_y&1){ //FIXME move out of this function?
|
if(mb_y&1){ //FIXME move out of this function?
|
||||||
dest_y -= s->linesize*15;
|
dest_y -= s->linesize*15;
|
||||||
dest_cb-= s->uvlinesize*7;
|
dest_cb-= s->uvlinesize*((8 << CHROMA444)-1);
|
||||||
dest_cr-= s->uvlinesize*7;
|
dest_cr-= s->uvlinesize*((8 << CHROMA444)-1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
linesize = h->mb_linesize = s->linesize;
|
linesize = h->mb_linesize = s->linesize;
|
||||||
@@ -3698,7 +3698,11 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//FIXME do not discard SEI id
|
//FIXME do not discard SEI id
|
||||||
if(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0)
|
if(
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
(s->hurry_up == 1 && h->nal_ref_idc == 0) ||
|
||||||
|
#endif
|
||||||
|
(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
@@ -3735,6 +3739,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(hx->redundant_pic_count==0
|
if(hx->redundant_pic_count==0
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
&& hx->s.hurry_up < 5
|
||||||
|
#endif
|
||||||
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
|
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
|
||||||
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
||||||
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
||||||
@@ -3772,6 +3779,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
|||||||
|
|
||||||
if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
|
if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
|
||||||
&& s->context_initialized
|
&& s->context_initialized
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
&& s->hurry_up < 5
|
||||||
|
#endif
|
||||||
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
|
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
|
||||||
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
||||||
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
||||||
@@ -3910,7 +3920,11 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
|
if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
|
||||||
if (avctx->skip_frame >= AVDISCARD_NONREF)
|
if (avctx->skip_frame >= AVDISCARD_NONREF
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
|| s->hurry_up
|
||||||
|
#endif
|
||||||
|
)
|
||||||
return 0;
|
return 0;
|
||||||
av_log(avctx, AV_LOG_ERROR, "no frame!\n");
|
av_log(avctx, AV_LOG_ERROR, "no frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -393,10 +393,10 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
|
|||||||
AV_WN64A(bS, 0x0003000300030003ULL);
|
AV_WN64A(bS, 0x0003000300030003ULL);
|
||||||
} else {
|
} else {
|
||||||
if(!CABAC && IS_8x8DCT(s->current_picture.mb_type[mbn_xy])){
|
if(!CABAC && IS_8x8DCT(s->current_picture.mb_type[mbn_xy])){
|
||||||
bS[0]= 1+((h->cbp_table[mbn_xy] & 4)||h->non_zero_count_cache[scan8[0]+0]);
|
bS[0]= 1+((h->cbp_table[mbn_xy] & 0x4000)||h->non_zero_count_cache[scan8[0]+0]);
|
||||||
bS[1]= 1+((h->cbp_table[mbn_xy] & 4)||h->non_zero_count_cache[scan8[0]+1]);
|
bS[1]= 1+((h->cbp_table[mbn_xy] & 0x4000)||h->non_zero_count_cache[scan8[0]+1]);
|
||||||
bS[2]= 1+((h->cbp_table[mbn_xy] & 8)||h->non_zero_count_cache[scan8[0]+2]);
|
bS[2]= 1+((h->cbp_table[mbn_xy] & 0x8000)||h->non_zero_count_cache[scan8[0]+2]);
|
||||||
bS[3]= 1+((h->cbp_table[mbn_xy] & 8)||h->non_zero_count_cache[scan8[0]+3]);
|
bS[3]= 1+((h->cbp_table[mbn_xy] & 0x8000)||h->non_zero_count_cache[scan8[0]+3]);
|
||||||
}else{
|
}else{
|
||||||
const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 3*4;
|
const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 3*4;
|
||||||
int i;
|
int i;
|
||||||
@@ -635,7 +635,7 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint
|
|||||||
else{
|
else{
|
||||||
bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] |
|
bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] |
|
||||||
((!h->pps.cabac && IS_8x8DCT(mbn_type)) ?
|
((!h->pps.cabac && IS_8x8DCT(mbn_type)) ?
|
||||||
(h->cbp_table[mbn_xy] & ((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2))
|
(h->cbp_table[mbn_xy] & (((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2) << 12))
|
||||||
:
|
:
|
||||||
h->non_zero_count[mbn_xy][ off[i] ]));
|
h->non_zero_count[mbn_xy][ off[i] ]));
|
||||||
}
|
}
|
||||||
@@ -663,19 +663,33 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint
|
|||||||
filter_mb_mbaff_edgev ( h, img_y , linesize, bS , 1, qp [0] );
|
filter_mb_mbaff_edgev ( h, img_y , linesize, bS , 1, qp [0] );
|
||||||
filter_mb_mbaff_edgev ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1] );
|
filter_mb_mbaff_edgev ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1] );
|
||||||
if (chroma){
|
if (chroma){
|
||||||
filter_mb_mbaff_edgecv( h, img_cb, uvlinesize, bS , 1, bqp[0] );
|
if (CHROMA444) {
|
||||||
filter_mb_mbaff_edgecv( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1] );
|
filter_mb_mbaff_edgev ( h, img_cb, uvlinesize, bS , 1, bqp[0] );
|
||||||
filter_mb_mbaff_edgecv( h, img_cr, uvlinesize, bS , 1, rqp[0] );
|
filter_mb_mbaff_edgev ( h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1] );
|
||||||
filter_mb_mbaff_edgecv( h, img_cr + 4*uvlinesize, uvlinesize, bS+4, 1, rqp[1] );
|
filter_mb_mbaff_edgev ( h, img_cr, uvlinesize, bS , 1, rqp[0] );
|
||||||
|
filter_mb_mbaff_edgev ( h, img_cr + 8*uvlinesize, uvlinesize, bS+4, 1, rqp[1] );
|
||||||
|
}else{
|
||||||
|
filter_mb_mbaff_edgecv( h, img_cb, uvlinesize, bS , 1, bqp[0] );
|
||||||
|
filter_mb_mbaff_edgecv( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1] );
|
||||||
|
filter_mb_mbaff_edgecv( h, img_cr, uvlinesize, bS , 1, rqp[0] );
|
||||||
|
filter_mb_mbaff_edgecv( h, img_cr + 4*uvlinesize, uvlinesize, bS+4, 1, rqp[1] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
filter_mb_mbaff_edgev ( h, img_y , 2* linesize, bS , 2, qp [0] );
|
filter_mb_mbaff_edgev ( h, img_y , 2* linesize, bS , 2, qp [0] );
|
||||||
filter_mb_mbaff_edgev ( h, img_y + linesize, 2* linesize, bS+1, 2, qp [1] );
|
filter_mb_mbaff_edgev ( h, img_y + linesize, 2* linesize, bS+1, 2, qp [1] );
|
||||||
if (chroma){
|
if (chroma){
|
||||||
filter_mb_mbaff_edgecv( h, img_cb, 2*uvlinesize, bS , 2, bqp[0] );
|
if (CHROMA444) {
|
||||||
filter_mb_mbaff_edgecv( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] );
|
filter_mb_mbaff_edgev ( h, img_cb, 2*uvlinesize, bS , 2, bqp[0] );
|
||||||
filter_mb_mbaff_edgecv( h, img_cr, 2*uvlinesize, bS , 2, rqp[0] );
|
filter_mb_mbaff_edgev ( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] );
|
||||||
filter_mb_mbaff_edgecv( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] );
|
filter_mb_mbaff_edgev ( h, img_cr, 2*uvlinesize, bS , 2, rqp[0] );
|
||||||
|
filter_mb_mbaff_edgev ( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] );
|
||||||
|
}else{
|
||||||
|
filter_mb_mbaff_edgecv( h, img_cb, 2*uvlinesize, bS , 2, bqp[0] );
|
||||||
|
filter_mb_mbaff_edgecv( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] );
|
||||||
|
filter_mb_mbaff_edgecv( h, img_cr, 2*uvlinesize, bS , 2, rqp[0] );
|
||||||
|
filter_mb_mbaff_edgecv( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -281,12 +281,12 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s
|
|||||||
decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb
|
decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb
|
||||||
if(is_sps || pps->transform_8x8_mode){
|
if(is_sps || pps->transform_8x8_mode){
|
||||||
decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y
|
decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y
|
||||||
if(h->sps.chroma_format_idc == 3){
|
if(sps->chroma_format_idc == 3){
|
||||||
decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[0],scaling_matrix8[0]); // Intra, Cr
|
decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[0],scaling_matrix8[0]); // Intra, Cr
|
||||||
decode_scaling_list(h,scaling_matrix8[2],64,default_scaling8[0],scaling_matrix8[1]); // Intra, Cb
|
decode_scaling_list(h,scaling_matrix8[2],64,default_scaling8[0],scaling_matrix8[1]); // Intra, Cb
|
||||||
}
|
}
|
||||||
decode_scaling_list(h,scaling_matrix8[3],64,default_scaling8[1],fallback[3]); // Inter, Y
|
decode_scaling_list(h,scaling_matrix8[3],64,default_scaling8[1],fallback[3]); // Inter, Y
|
||||||
if(h->sps.chroma_format_idc == 3){
|
if(sps->chroma_format_idc == 3){
|
||||||
decode_scaling_list(h,scaling_matrix8[4],64,default_scaling8[1],scaling_matrix8[3]); // Inter, Cr
|
decode_scaling_list(h,scaling_matrix8[4],64,default_scaling8[1],scaling_matrix8[3]); // Inter, Cr
|
||||||
decode_scaling_list(h,scaling_matrix8[5],64,default_scaling8[1],scaling_matrix8[4]); // Inter, Cb
|
decode_scaling_list(h,scaling_matrix8[5],64,default_scaling8[1],scaling_matrix8[4]); // Inter, Cb
|
||||||
}
|
}
|
||||||
@@ -396,6 +396,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||||||
#endif
|
#endif
|
||||||
sps->crop= get_bits1(&s->gb);
|
sps->crop= get_bits1(&s->gb);
|
||||||
if(sps->crop){
|
if(sps->crop){
|
||||||
|
int crop_limit = sps->chroma_format_idc == 3 ? 16 : 8;
|
||||||
sps->crop_left = get_ue_golomb(&s->gb);
|
sps->crop_left = get_ue_golomb(&s->gb);
|
||||||
sps->crop_right = get_ue_golomb(&s->gb);
|
sps->crop_right = get_ue_golomb(&s->gb);
|
||||||
sps->crop_top = get_ue_golomb(&s->gb);
|
sps->crop_top = get_ue_golomb(&s->gb);
|
||||||
@@ -403,7 +404,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
|||||||
if(sps->crop_left || sps->crop_top){
|
if(sps->crop_left || sps->crop_top){
|
||||||
av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
|
av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
|
||||||
}
|
}
|
||||||
if(sps->crop_right >= (8<<CHROMA444) || sps->crop_bottom >= (8<<CHROMA444)){
|
if(sps->crop_right >= crop_limit || sps->crop_bottom >= crop_limit){
|
||||||
av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n");
|
av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
@@ -72,7 +72,6 @@ typedef struct IdcinContext {
|
|||||||
hnode huff_nodes[256][HUF_TOKENS*2];
|
hnode huff_nodes[256][HUF_TOKENS*2];
|
||||||
int num_huff_nodes[256];
|
int num_huff_nodes[256];
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} IdcinContext;
|
} IdcinContext;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -215,7 +214,7 @@ static int idcin_decode_frame(AVCodecContext *avctx,
|
|||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
IdcinContext *s = avctx->priv_data;
|
IdcinContext *s = avctx->priv_data;
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
AVPaletteControl *palette_control = avctx->palctrl;
|
||||||
|
|
||||||
s->buf = buf;
|
s->buf = buf;
|
||||||
s->size = buf_size;
|
s->size = buf_size;
|
||||||
@@ -230,12 +229,13 @@ static int idcin_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
idcin_decode_vlcs(s);
|
idcin_decode_vlcs(s);
|
||||||
|
|
||||||
if (pal) {
|
|
||||||
s->frame.palette_has_changed = 1;
|
|
||||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
|
||||||
}
|
|
||||||
/* make the palette available on the way out */
|
/* make the palette available on the way out */
|
||||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
memcpy(s->frame.data[1], palette_control->palette, PALETTE_COUNT * 4);
|
||||||
|
/* If palette changed inform application*/
|
||||||
|
if (palette_control->palette_changed) {
|
||||||
|
palette_control->palette_changed = 0;
|
||||||
|
s->frame.palette_has_changed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
*data_size = sizeof(AVFrame);
|
*data_size = sizeof(AVFrame);
|
||||||
*(AVFrame*)data = s->frame;
|
*(AVFrame*)data = s->frame;
|
||||||
|
@@ -424,11 +424,40 @@ const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
enum PixelFormat avcodec_get_pix_fmt(const char *name)
|
||||||
|
{
|
||||||
|
return av_get_pix_fmt(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
|
||||||
|
{
|
||||||
|
av_get_pix_fmt_string(buf, buf_size, pix_fmt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
|
int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
|
||||||
{
|
{
|
||||||
return av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL;
|
return av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){
|
||||||
|
return ff_set_systematic_pal2(pal, pix_fmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
|
||||||
|
{
|
||||||
|
return av_image_fill_linesizes(picture->linesize, pix_fmt, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
|
||||||
|
int height)
|
||||||
|
{
|
||||||
|
return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture->linesize);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
|
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
|
||||||
enum PixelFormat pix_fmt, int width, int height)
|
enum PixelFormat pix_fmt, int width, int height)
|
||||||
{
|
{
|
||||||
@@ -663,6 +692,28 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma
|
|||||||
return dst_pix_fmt;
|
return dst_pix_fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
|
||||||
|
const uint8_t *src, int src_wrap,
|
||||||
|
int width, int height)
|
||||||
|
{
|
||||||
|
av_image_copy_plane(dst, dst_wrap, src, src_wrap, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
|
||||||
|
{
|
||||||
|
return av_image_get_linesize(pix_fmt, width, plane);
|
||||||
|
}
|
||||||
|
|
||||||
|
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
|
||||||
|
uint8_t *src_data[4], int src_linesize[4],
|
||||||
|
enum PixelFormat pix_fmt, int width, int height)
|
||||||
|
{
|
||||||
|
av_image_copy(dst_data, dst_linesize, src_data, src_linesize,
|
||||||
|
pix_fmt, width, height);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
||||||
enum PixelFormat pix_fmt, int width, int height)
|
enum PixelFormat pix_fmt, int width, int height)
|
||||||
{
|
{
|
||||||
|
@@ -69,7 +69,6 @@ typedef struct IpvideoContext {
|
|||||||
int stride;
|
int stride;
|
||||||
int upper_motion_limit_offset;
|
int upper_motion_limit_offset;
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} IpvideoContext;
|
} IpvideoContext;
|
||||||
|
|
||||||
#define CHECK_STREAM_PTR(stream_ptr, stream_end, n) \
|
#define CHECK_STREAM_PTR(stream_ptr, stream_end, n) \
|
||||||
@@ -962,7 +961,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
|
|||||||
|
|
||||||
if (!s->is_16bpp) {
|
if (!s->is_16bpp) {
|
||||||
/* this is PAL8, so make the palette available */
|
/* this is PAL8, so make the palette available */
|
||||||
memcpy(s->current_frame.data[1], s->pal, AVPALETTE_SIZE);
|
memcpy(s->current_frame.data[1], s->avctx->palctrl->palette, PALETTE_COUNT * 4);
|
||||||
|
|
||||||
s->stride = s->current_frame.linesize[0];
|
s->stride = s->current_frame.linesize[0];
|
||||||
s->stream_ptr = s->buf + 14; /* data starts 14 bytes in */
|
s->stream_ptr = s->buf + 14; /* data starts 14 bytes in */
|
||||||
@@ -1016,6 +1015,10 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
s->is_16bpp = avctx->bits_per_coded_sample == 16;
|
s->is_16bpp = avctx->bits_per_coded_sample == 16;
|
||||||
avctx->pix_fmt = s->is_16bpp ? PIX_FMT_RGB555 : PIX_FMT_PAL8;
|
avctx->pix_fmt = s->is_16bpp ? PIX_FMT_RGB555 : PIX_FMT_PAL8;
|
||||||
|
if (!s->is_16bpp && s->avctx->palctrl == NULL) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, " Interplay video: palette expected.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
dsputil_init(&s->dsp, avctx);
|
dsputil_init(&s->dsp, avctx);
|
||||||
|
|
||||||
@@ -1038,6 +1041,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
|||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
IpvideoContext *s = avctx->priv_data;
|
IpvideoContext *s = avctx->priv_data;
|
||||||
|
AVPaletteControl *palette_control = avctx->palctrl;
|
||||||
|
|
||||||
/* compressed buffer needs to be large enough to at least hold an entire
|
/* compressed buffer needs to be large enough to at least hold an entire
|
||||||
* decoding map */
|
* decoding map */
|
||||||
@@ -1054,16 +1058,13 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->is_16bpp) {
|
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
|
||||||
if (pal) {
|
|
||||||
s->current_frame.palette_has_changed = 1;
|
|
||||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ipvideo_decode_opcodes(s);
|
ipvideo_decode_opcodes(s);
|
||||||
|
|
||||||
|
if (!s->is_16bpp && palette_control->palette_changed) {
|
||||||
|
palette_control->palette_changed = 0;
|
||||||
|
s->current_frame.palette_has_changed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
*data_size = sizeof(AVFrame);
|
*data_size = sizeof(AVFrame);
|
||||||
*(AVFrame*)data = s->current_frame;
|
*(AVFrame*)data = s->current_frame;
|
||||||
|
|
||||||
|
@@ -233,7 +233,6 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
|
|||||||
int i;
|
int i;
|
||||||
int header;
|
int header;
|
||||||
int blocksize;
|
int blocksize;
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
|
||||||
|
|
||||||
if (ctx->pic.data[0])
|
if (ctx->pic.data[0])
|
||||||
avctx->release_buffer(avctx, &ctx->pic);
|
avctx->release_buffer(avctx, &ctx->pic);
|
||||||
@@ -265,6 +264,13 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
|
|||||||
ctx->pic.pict_type = AV_PICTURE_TYPE_P;
|
ctx->pic.pict_type = AV_PICTURE_TYPE_P;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if palette has been changed, copy it from palctrl */
|
||||||
|
if (ctx->avctx->palctrl && ctx->avctx->palctrl->palette_changed) {
|
||||||
|
memcpy(ctx->pal, ctx->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
ctx->setpal = 1;
|
||||||
|
ctx->avctx->palctrl->palette_changed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (header & KMVC_PALETTE) {
|
if (header & KMVC_PALETTE) {
|
||||||
ctx->pic.palette_has_changed = 1;
|
ctx->pic.palette_has_changed = 1;
|
||||||
// palette starts from index 1 and has 127 entries
|
// palette starts from index 1 and has 127 entries
|
||||||
@@ -273,11 +279,6 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pal) {
|
|
||||||
ctx->pic.palette_has_changed = 1;
|
|
||||||
memcpy(ctx->pal, pal, AVPALETTE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->setpal) {
|
if (ctx->setpal) {
|
||||||
ctx->setpal = 0;
|
ctx->setpal = 0;
|
||||||
ctx->pic.palette_has_changed = 1;
|
ctx->pic.palette_has_changed = 1;
|
||||||
@@ -373,6 +374,9 @@ static av_cold int decode_init(AVCodecContext * avctx)
|
|||||||
src += 4;
|
src += 4;
|
||||||
}
|
}
|
||||||
c->setpal = 1;
|
c->setpal = 1;
|
||||||
|
if (c->avctx->palctrl) {
|
||||||
|
c->avctx->palctrl->palette_changed = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
avcodec_get_frame_defaults(&c->pic);
|
avcodec_get_frame_defaults(&c->pic);
|
||||||
|
@@ -2475,10 +2475,18 @@ static int decode_chunks(AVCodecContext *avctx,
|
|||||||
/* Skip P-frames if we do not have a reference frame or we have an invalid header. */
|
/* Skip P-frames if we do not have a reference frame or we have an invalid header. */
|
||||||
if(s2->pict_type==AV_PICTURE_TYPE_P && !s->sync) break;
|
if(s2->pict_type==AV_PICTURE_TYPE_P && !s->sync) break;
|
||||||
}
|
}
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* Skip B-frames if we are in a hurry. */
|
||||||
|
if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
|
||||||
|
#endif
|
||||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==AV_PICTURE_TYPE_B)
|
if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==AV_PICTURE_TYPE_B)
|
||||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=AV_PICTURE_TYPE_I)
|
||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=AV_PICTURE_TYPE_I)
|
||||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||||
break;
|
break;
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* Skip everything if we are in a hurry>=5. */
|
||||||
|
if(avctx->hurry_up>=5) break;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!s->mpeg_enc_ctx_allocated) break;
|
if (!s->mpeg_enc_ctx_allocated) break;
|
||||||
|
|
||||||
|
@@ -1138,6 +1138,9 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
s->hurry_up= s->avctx->hurry_up;
|
||||||
|
#endif
|
||||||
s->error_recognition= avctx->error_recognition;
|
s->error_recognition= avctx->error_recognition;
|
||||||
|
|
||||||
/* set dequantizer, we can't do it during init as it might change for mpeg4
|
/* set dequantizer, we can't do it during init as it might change for mpeg4
|
||||||
@@ -2147,6 +2150,9 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* skip dequant / idct if we are really late ;) */
|
/* skip dequant / idct if we are really late ;) */
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
if(s->hurry_up>1) goto skip_idct;
|
||||||
|
#endif
|
||||||
if(s->avctx->skip_idct){
|
if(s->avctx->skip_idct){
|
||||||
if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
|
if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
|
||||||
||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
|
||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
|
||||||
|
@@ -391,6 +391,11 @@ typedef struct MpegEncContext {
|
|||||||
int no_rounding; /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
|
int no_rounding; /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
|
||||||
for b-frames rounding mode is always 0 */
|
for b-frames rounding mode is always 0 */
|
||||||
|
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
int hurry_up; /**< when set to 1 during decoding, b frames will be skipped
|
||||||
|
when set to 2 idct/dequant will be skipped too */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* macroblock layer */
|
/* macroblock layer */
|
||||||
int mb_x, mb_y;
|
int mb_x, mb_y;
|
||||||
int mb_skip_run;
|
int mb_skip_run;
|
||||||
|
@@ -26,6 +26,9 @@
|
|||||||
* http://www.pcisys.net/~melanson/codecs/
|
* http://www.pcisys.net/~melanson/codecs/
|
||||||
*
|
*
|
||||||
* The MS RLE decoder outputs PAL8 colorspace data.
|
* The MS RLE decoder outputs PAL8 colorspace data.
|
||||||
|
*
|
||||||
|
* Note that this decoder expects the palette colors from the end of the
|
||||||
|
* BITMAPINFO header passed through palctrl.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -43,7 +46,6 @@ typedef struct MsrleContext {
|
|||||||
const unsigned char *buf;
|
const unsigned char *buf;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} MsrleContext;
|
} MsrleContext;
|
||||||
|
|
||||||
static av_cold int msrle_decode_init(AVCodecContext *avctx)
|
static av_cold int msrle_decode_init(AVCodecContext *avctx)
|
||||||
@@ -93,16 +95,13 @@ static int msrle_decode_frame(AVCodecContext *avctx,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
|
if (s->avctx->palctrl) {
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
|
||||||
|
|
||||||
if (pal) {
|
|
||||||
s->frame.palette_has_changed = 1;
|
|
||||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make the palette available */
|
/* make the palette available */
|
||||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
if (s->avctx->palctrl->palette_changed) {
|
||||||
|
s->frame.palette_has_changed = 1;
|
||||||
|
s->avctx->palctrl->palette_changed = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME how to correctly detect RLE ??? */
|
/* FIXME how to correctly detect RLE ??? */
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
* For more information about the MS Video-1 format, visit:
|
* For more information about the MS Video-1 format, visit:
|
||||||
* http://www.pcisys.net/~melanson/codecs/
|
* http://www.pcisys.net/~melanson/codecs/
|
||||||
*
|
*
|
||||||
|
* This decoder outputs either PAL8 or RGB555 data, depending on the
|
||||||
|
* whether a RGB palette was passed through palctrl;
|
||||||
|
* if it's present, then the data is PAL8; RGB555 otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -52,7 +55,6 @@ typedef struct Msvideo1Context {
|
|||||||
|
|
||||||
int mode_8bit; /* if it's not 8-bit, it's 16-bit */
|
int mode_8bit; /* if it's not 8-bit, it's 16-bit */
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} Msvideo1Context;
|
} Msvideo1Context;
|
||||||
|
|
||||||
static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
|
static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
|
||||||
@@ -62,7 +64,7 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
|
|||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
|
|
||||||
/* figure out the colorspace based on the presence of a palette */
|
/* figure out the colorspace based on the presence of a palette */
|
||||||
if (s->avctx->bits_per_coded_sample == 8) {
|
if (s->avctx->palctrl) {
|
||||||
s->mode_8bit = 1;
|
s->mode_8bit = 1;
|
||||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||||
} else {
|
} else {
|
||||||
@@ -172,8 +174,13 @@ static void msvideo1_decode_8bit(Msvideo1Context *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make the palette available on the way out */
|
/* make the palette available on the way out */
|
||||||
if (s->avctx->pix_fmt == PIX_FMT_PAL8)
|
if (s->avctx->pix_fmt == PIX_FMT_PAL8) {
|
||||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
if (s->avctx->palctrl->palette_changed) {
|
||||||
|
s->frame.palette_has_changed = 1;
|
||||||
|
s->avctx->palctrl->palette_changed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void msvideo1_decode_16bit(Msvideo1Context *s)
|
static void msvideo1_decode_16bit(Msvideo1Context *s)
|
||||||
@@ -303,15 +310,6 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->mode_8bit) {
|
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
|
||||||
|
|
||||||
if (pal) {
|
|
||||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
|
||||||
s->frame.palette_has_changed = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->mode_8bit)
|
if (s->mode_8bit)
|
||||||
msvideo1_decode_8bit(s);
|
msvideo1_decode_8bit(s);
|
||||||
else
|
else
|
||||||
|
89
libavcodec/opt.c
Normal file
89
libavcodec/opt.c
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* AVOptions ABI compatibility wrapper
|
||||||
|
* Copyright (c) 2010 Michael Niedermayer <michaelni@gmx.at>
|
||||||
|
*
|
||||||
|
* This file is part of Libav.
|
||||||
|
*
|
||||||
|
* Libav is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Libav is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with Libav; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "avcodec.h"
|
||||||
|
#include "opt.h"
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53 && CONFIG_SHARED && HAVE_SYMVER
|
||||||
|
|
||||||
|
FF_SYMVER(const AVOption *, av_find_opt, (void *obj, const char *name, const char *unit, int mask, int flags), "LIBAVCODEC_52"){
|
||||||
|
return av_find_opt(obj, name, unit, mask, flags);
|
||||||
|
}
|
||||||
|
FF_SYMVER(int, av_set_string3, (void *obj, const char *name, const char *val, int alloc, const AVOption **o_out), "LIBAVCODEC_52"){
|
||||||
|
return av_set_string3(obj, name, val, alloc, o_out);
|
||||||
|
}
|
||||||
|
FF_SYMVER(const AVOption *, av_set_double, (void *obj, const char *name, double n), "LIBAVCODEC_52"){
|
||||||
|
return av_set_double(obj, name, n);
|
||||||
|
}
|
||||||
|
FF_SYMVER(const AVOption *, av_set_q, (void *obj, const char *name, AVRational n), "LIBAVCODEC_52"){
|
||||||
|
return av_set_q(obj, name, n);
|
||||||
|
}
|
||||||
|
FF_SYMVER(const AVOption *, av_set_int, (void *obj, const char *name, int64_t n), "LIBAVCODEC_52"){
|
||||||
|
return av_set_int(obj, name, n);
|
||||||
|
}
|
||||||
|
FF_SYMVER(double, av_get_double, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){
|
||||||
|
return av_get_double(obj, name, o_out);
|
||||||
|
}
|
||||||
|
FF_SYMVER(AVRational, av_get_q, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){
|
||||||
|
return av_get_q(obj, name, o_out);
|
||||||
|
}
|
||||||
|
FF_SYMVER(int64_t, av_get_int, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){
|
||||||
|
return av_get_int(obj, name, o_out);
|
||||||
|
}
|
||||||
|
FF_SYMVER(const char *, av_get_string, (void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len), "LIBAVCODEC_52"){
|
||||||
|
return av_get_string(obj, name, o_out, buf, buf_len);
|
||||||
|
}
|
||||||
|
FF_SYMVER(const AVOption *, av_next_option, (void *obj, const AVOption *last), "LIBAVCODEC_52"){
|
||||||
|
return av_next_option(obj, last);
|
||||||
|
}
|
||||||
|
FF_SYMVER(int, av_opt_show2, (void *obj, void *av_log_obj, int req_flags, int rej_flags), "LIBAVCODEC_52"){
|
||||||
|
return av_opt_show2(obj, av_log_obj, req_flags, rej_flags);
|
||||||
|
}
|
||||||
|
FF_SYMVER(void, av_opt_set_defaults, (void *s), "LIBAVCODEC_52"){
|
||||||
|
return av_opt_set_defaults(s);
|
||||||
|
}
|
||||||
|
FF_SYMVER(void, av_opt_set_defaults2, (void *s, int mask, int flags), "LIBAVCODEC_52"){
|
||||||
|
return av_opt_set_defaults2(s, mask, flags);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FF_API_SET_STRING_OLD
|
||||||
|
const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc){
|
||||||
|
const AVOption *o;
|
||||||
|
if (av_set_string3(obj, name, val, alloc, &o) < 0)
|
||||||
|
return NULL;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AVOption *av_set_string(void *obj, const char *name, const char *val){
|
||||||
|
const AVOption *o;
|
||||||
|
if (av_set_string3(obj, name, val, 0, &o) < 0)
|
||||||
|
return NULL;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FF_API_OPT_SHOW
|
||||||
|
int av_opt_show(void *obj, void *av_log_obj){
|
||||||
|
return av_opt_show2(obj, av_log_obj,
|
||||||
|
AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
|
||||||
|
}
|
||||||
|
#endif
|
@@ -1,16 +1,55 @@
|
|||||||
/**
|
/*
|
||||||
* @file
|
* AVOptions
|
||||||
* This header is provided for compatibility only and will be removed
|
* copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
|
||||||
* on next major bump
|
*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef AVCODEC_OPT_H
|
#ifndef AVCODEC_OPT_H
|
||||||
#define AVCODEC_OPT_H
|
#define AVCODEC_OPT_H
|
||||||
|
|
||||||
#include "libavcodec/version.h"
|
/**
|
||||||
|
* @file
|
||||||
|
* AVOptions
|
||||||
|
*/
|
||||||
|
|
||||||
#if FF_API_OPT_H
|
#include "libavutil/rational.h"
|
||||||
|
#include "avcodec.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
|
|
||||||
|
#if FF_API_SET_STRING_OLD
|
||||||
|
/**
|
||||||
|
* @see av_set_string2()
|
||||||
|
*/
|
||||||
|
attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a pointer to the AVOption corresponding to the field set or
|
||||||
|
* NULL if no matching AVOption exists, or if the value val is not
|
||||||
|
* valid
|
||||||
|
* @see av_set_string3()
|
||||||
|
*/
|
||||||
|
attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc);
|
||||||
|
#endif
|
||||||
|
#if FF_API_OPT_SHOW
|
||||||
|
/**
|
||||||
|
* @deprecated Use av_opt_show2() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int av_opt_show(void *obj, void *av_log_obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* AVCODEC_OPT_H */
|
#endif /* AVCODEC_OPT_H */
|
||||||
|
@@ -438,6 +438,7 @@ static const AVOption options[]={
|
|||||||
{"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, V|E},
|
{"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, V|E},
|
||||||
{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX },
|
{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX },
|
||||||
#if FF_API_FLAC_GLOBAL_OPTS
|
#if FF_API_FLAC_GLOBAL_OPTS
|
||||||
|
{"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E},
|
||||||
{"lpc_type", "deprecated, use flac-specific options", OFFSET(lpc_type), FF_OPT_TYPE_INT, {.dbl = AV_LPC_TYPE_DEFAULT }, AV_LPC_TYPE_DEFAULT, AV_LPC_TYPE_NB-1, A|E},
|
{"lpc_type", "deprecated, use flac-specific options", OFFSET(lpc_type), FF_OPT_TYPE_INT, {.dbl = AV_LPC_TYPE_DEFAULT }, AV_LPC_TYPE_DEFAULT, AV_LPC_TYPE_NB-1, A|E},
|
||||||
{"none", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_NONE }, INT_MIN, INT_MAX, A|E, "lpc_type"},
|
{"none", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_NONE }, INT_MIN, INT_MAX, A|E, "lpc_type"},
|
||||||
{"fixed", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, A|E, "lpc_type"},
|
{"fixed", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, A|E, "lpc_type"},
|
||||||
|
@@ -105,6 +105,43 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param buf input
|
||||||
|
* @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output)
|
||||||
|
* @param pts input presentation timestamp
|
||||||
|
* @param dts input decoding timestamp
|
||||||
|
* @param poutbuf will contain a pointer to the first byte of the output frame
|
||||||
|
* @param poutbuf_size will contain the length of the output frame
|
||||||
|
* @return the number of bytes of the input bitstream used
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* while(in_len){
|
||||||
|
* len = av_parser_parse(myparser, AVCodecContext, &data, &size,
|
||||||
|
* in_data, in_len,
|
||||||
|
* pts, dts);
|
||||||
|
* in_data += len;
|
||||||
|
* in_len -= len;
|
||||||
|
*
|
||||||
|
* if(size)
|
||||||
|
* decode_frame(data, size);
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @deprecated Use av_parser_parse2() instead.
|
||||||
|
*/
|
||||||
|
int av_parser_parse(AVCodecParserContext *s,
|
||||||
|
AVCodecContext *avctx,
|
||||||
|
uint8_t **poutbuf, int *poutbuf_size,
|
||||||
|
const uint8_t *buf, int buf_size,
|
||||||
|
int64_t pts, int64_t dts)
|
||||||
|
{
|
||||||
|
return av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, AV_NOPTS_VALUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int av_parser_parse2(AVCodecParserContext *s,
|
int av_parser_parse2(AVCodecParserContext *s,
|
||||||
AVCodecContext *avctx,
|
AVCodecContext *avctx,
|
||||||
uint8_t **poutbuf, int *poutbuf_size,
|
uint8_t **poutbuf, int *poutbuf_size,
|
||||||
|
@@ -380,6 +380,9 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
|
|||||||
dst->release_buffer = src->release_buffer;
|
dst->release_buffer = src->release_buffer;
|
||||||
|
|
||||||
dst->opaque = src->opaque;
|
dst->opaque = src->opaque;
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
dst->hurry_up = src->hurry_up;
|
||||||
|
#endif
|
||||||
dst->dsp_mask = src->dsp_mask;
|
dst->dsp_mask = src->dsp_mask;
|
||||||
dst->debug = src->debug;
|
dst->debug = src->debug;
|
||||||
dst->debug_mv = src->debug_mv;
|
dst->debug_mv = src->debug_mv;
|
||||||
|
@@ -260,7 +260,6 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
AVFrame * ref= (AVFrame*)&a->ref;
|
AVFrame * ref= (AVFrame*)&a->ref;
|
||||||
uint8_t* outdata;
|
uint8_t* outdata;
|
||||||
int delta;
|
int delta;
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
|
||||||
|
|
||||||
if(ref->data[0])
|
if(ref->data[0])
|
||||||
avctx->release_buffer(avctx, ref);
|
avctx->release_buffer(avctx, ref);
|
||||||
@@ -280,11 +279,11 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make the palette available on the way out */
|
/* make the palette available on the way out */
|
||||||
if (pal) {
|
memcpy(a->pic.data[1], a->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
if (a->avctx->palctrl->palette_changed) {
|
||||||
a->pic.palette_has_changed = 1;
|
a->pic.palette_has_changed = 1;
|
||||||
memcpy(a->pal, pal, AVPALETTE_SIZE);
|
a->avctx->palctrl->palette_changed = 0;
|
||||||
}
|
}
|
||||||
memcpy(a->pic.data[1], a->pal, AVPALETTE_SIZE);
|
|
||||||
|
|
||||||
*data_size = sizeof(AVFrame);
|
*data_size = sizeof(AVFrame);
|
||||||
*(AVFrame*)data = a->pic;
|
*(AVFrame*)data = a->pic;
|
||||||
@@ -295,6 +294,10 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
static av_cold int decode_init(AVCodecContext *avctx){
|
static av_cold int decode_init(AVCodecContext *avctx){
|
||||||
QpegContext * const a = avctx->priv_data;
|
QpegContext * const a = avctx->priv_data;
|
||||||
|
|
||||||
|
if (!avctx->palctrl) {
|
||||||
|
av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
avcodec_get_frame_defaults(&a->pic);
|
avcodec_get_frame_defaults(&a->pic);
|
||||||
avcodec_get_frame_defaults(&a->ref);
|
avcodec_get_frame_defaults(&a->ref);
|
||||||
a->avctx = avctx;
|
a->avctx = avctx;
|
||||||
|
@@ -46,7 +46,6 @@ typedef struct QtrleContext {
|
|||||||
const unsigned char *buf;
|
const unsigned char *buf;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} QtrleContext;
|
} QtrleContext;
|
||||||
|
|
||||||
#define CHECK_STREAM_PTR(n) \
|
#define CHECK_STREAM_PTR(n) \
|
||||||
@@ -513,15 +512,12 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(has_palette) {
|
if(has_palette) {
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
|
||||||
|
|
||||||
if (pal) {
|
|
||||||
s->frame.palette_has_changed = 1;
|
|
||||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make the palette available on the way out */
|
/* make the palette available on the way out */
|
||||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
if (s->avctx->palctrl->palette_changed) {
|
||||||
|
s->frame.palette_has_changed = 1;
|
||||||
|
s->avctx->palctrl->palette_changed = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@@ -184,13 +184,9 @@ static int raw_decode(AVCodecContext *avctx,
|
|||||||
(av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){
|
(av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){
|
||||||
frame->data[1]= context->palette;
|
frame->data[1]= context->palette;
|
||||||
}
|
}
|
||||||
if (avctx->pix_fmt == PIX_FMT_PAL8) {
|
if (avctx->palctrl && avctx->palctrl->palette_changed) {
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
memcpy(frame->data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
avctx->palctrl->palette_changed = 0;
|
||||||
if (pal) {
|
|
||||||
memcpy(frame->data[1], pal, AVPALETTE_SIZE);
|
|
||||||
frame->palette_has_changed = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(avctx->pix_fmt==PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
|
if(avctx->pix_fmt==PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
|
||||||
frame->linesize[0] = (frame->linesize[0]+3)&~3;
|
frame->linesize[0] = (frame->linesize[0]+3)&~3;
|
||||||
|
@@ -275,6 +275,17 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_AUDIO_OLD
|
||||||
|
ReSampleContext *audio_resample_init(int output_channels, int input_channels,
|
||||||
|
int output_rate, int input_rate)
|
||||||
|
{
|
||||||
|
return av_audio_resample_init(output_channels, input_channels,
|
||||||
|
output_rate, input_rate,
|
||||||
|
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16,
|
||||||
|
TAPS, 10, 0, 0.8);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* resample audio. 'nb_samples' is the number of input samples */
|
/* resample audio. 'nb_samples' is the number of input samples */
|
||||||
/* XXX: optimize it ! */
|
/* XXX: optimize it ! */
|
||||||
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples)
|
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples)
|
||||||
|
@@ -1454,10 +1454,19 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == AV_PICTURE_TYPE_B)
|
if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == AV_PICTURE_TYPE_B)
|
||||||
return -1;
|
return -1;
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* skip b frames if we are in a hurry */
|
||||||
|
if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
|
||||||
|
#endif
|
||||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B)
|
if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B)
|
||||||
|| (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I)
|
|| (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I)
|
||||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||||
return buf_size;
|
return buf_size;
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* skip everything if we are in a hurry>=5 */
|
||||||
|
if(avctx->hurry_up>=5)
|
||||||
|
return buf_size;
|
||||||
|
#endif
|
||||||
|
|
||||||
for(i=0; i<slice_count; i++){
|
for(i=0; i<slice_count; i++){
|
||||||
int offset= get_slice_offset(avctx, slices_hdr, i);
|
int offset= get_slice_offset(avctx, slices_hdr, i);
|
||||||
|
@@ -54,7 +54,6 @@ typedef struct SmcContext {
|
|||||||
unsigned char color_quads[COLORS_PER_TABLE * CQUAD];
|
unsigned char color_quads[COLORS_PER_TABLE * CQUAD];
|
||||||
unsigned char color_octets[COLORS_PER_TABLE * COCTET];
|
unsigned char color_octets[COLORS_PER_TABLE * COCTET];
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} SmcContext;
|
} SmcContext;
|
||||||
|
|
||||||
#define GET_BLOCK_COUNT() \
|
#define GET_BLOCK_COUNT() \
|
||||||
@@ -111,7 +110,11 @@ static void smc_decode_stream(SmcContext *s)
|
|||||||
int color_octet_index = 0;
|
int color_octet_index = 0;
|
||||||
|
|
||||||
/* make the palette available */
|
/* make the palette available */
|
||||||
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
|
memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
if (s->avctx->palctrl->palette_changed) {
|
||||||
|
s->frame.palette_has_changed = 1;
|
||||||
|
s->avctx->palctrl->palette_changed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF;
|
chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF;
|
||||||
stream_ptr += 4;
|
stream_ptr += 4;
|
||||||
@@ -438,7 +441,6 @@ static int smc_decode_frame(AVCodecContext *avctx,
|
|||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
SmcContext *s = avctx->priv_data;
|
SmcContext *s = avctx->priv_data;
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
|
||||||
|
|
||||||
s->buf = buf;
|
s->buf = buf;
|
||||||
s->size = buf_size;
|
s->size = buf_size;
|
||||||
@@ -451,11 +453,6 @@ static int smc_decode_frame(AVCodecContext *avctx,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pal) {
|
|
||||||
s->frame.palette_has_changed = 1;
|
|
||||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
smc_decode_stream(s);
|
smc_decode_stream(s);
|
||||||
|
|
||||||
*data_size = sizeof(AVFrame);
|
*data_size = sizeof(AVFrame);
|
||||||
|
@@ -663,6 +663,9 @@ static int svq1_decode_frame(AVCodecContext *avctx,
|
|||||||
//this should be removed after libavcodec can handle more flexible picture types & ordering
|
//this should be removed after libavcodec can handle more flexible picture types & ordering
|
||||||
if(s->pict_type==AV_PICTURE_TYPE_B && s->last_picture_ptr==NULL) return buf_size;
|
if(s->pict_type==AV_PICTURE_TYPE_B && s->last_picture_ptr==NULL) return buf_size;
|
||||||
|
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
|
||||||
|
#endif
|
||||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||||
|
@@ -986,6 +986,14 @@ static int svq3_decode_frame(AVCodecContext *avctx,
|
|||||||
/* Skip B-frames if we do not have reference frames. */
|
/* Skip B-frames if we do not have reference frames. */
|
||||||
if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B)
|
if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B)
|
||||||
return 0;
|
return 0;
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* Skip B-frames if we are in a hurry. */
|
||||||
|
if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
|
||||||
|
return 0;
|
||||||
|
/* Skip everything if we are in a hurry >= 5. */
|
||||||
|
if (avctx->hurry_up >= 5)
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
|
if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
|
||||||
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
|
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
|
||||||
|| avctx->skip_frame >= AVDISCARD_ALL)
|
|| avctx->skip_frame >= AVDISCARD_ALL)
|
||||||
|
@@ -171,6 +171,13 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
stride = -p->linesize[0];
|
stride = -p->linesize[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(avctx->pix_fmt == PIX_FMT_PAL8 && avctx->palctrl){
|
||||||
|
memcpy(p->data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
if(avctx->palctrl->palette_changed){
|
||||||
|
p->palette_has_changed = 1;
|
||||||
|
avctx->palctrl->palette_changed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(colors){
|
if(colors){
|
||||||
size_t pal_size;
|
size_t pal_size;
|
||||||
if((colors + first_clr) > 256){
|
if((colors + first_clr) > 256){
|
||||||
|
@@ -60,8 +60,6 @@ typedef struct TsccContext {
|
|||||||
unsigned char* decomp_buf;
|
unsigned char* decomp_buf;
|
||||||
int height;
|
int height;
|
||||||
z_stream zstream;
|
z_stream zstream;
|
||||||
|
|
||||||
uint32_t pal[256];
|
|
||||||
} CamtasiaContext;
|
} CamtasiaContext;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -110,13 +108,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
|
|
||||||
/* make the palette available on the way out */
|
/* make the palette available on the way out */
|
||||||
if (c->avctx->pix_fmt == PIX_FMT_PAL8) {
|
if (c->avctx->pix_fmt == PIX_FMT_PAL8) {
|
||||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
memcpy(c->pic.data[1], c->avctx->palctrl->palette, AVPALETTE_SIZE);
|
||||||
|
if (c->avctx->palctrl->palette_changed) {
|
||||||
if (pal) {
|
|
||||||
c->pic.palette_has_changed = 1;
|
c->pic.palette_has_changed = 1;
|
||||||
memcpy(c->pal, pal, AVPALETTE_SIZE);
|
c->avctx->palctrl->palette_changed = 0;
|
||||||
}
|
}
|
||||||
memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*data_size = sizeof(AVFrame);
|
*data_size = sizeof(AVFrame);
|
||||||
|
@@ -48,7 +48,7 @@ static int volatile entangled_thread_counter=0;
|
|||||||
static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
|
static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
|
||||||
static void *codec_mutex;
|
static void *codec_mutex;
|
||||||
|
|
||||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
|
void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size)
|
||||||
{
|
{
|
||||||
if(min_size < *size)
|
if(min_size < *size)
|
||||||
return ptr;
|
return ptr;
|
||||||
@@ -64,7 +64,7 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
|
void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size)
|
||||||
{
|
{
|
||||||
void **p = ptr;
|
void **p = ptr;
|
||||||
if (min_size < *size)
|
if (min_size < *size)
|
||||||
@@ -94,6 +94,13 @@ void avcodec_register(AVCodec *codec)
|
|||||||
codec->next = NULL;
|
codec->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
void register_avcodec(AVCodec *codec)
|
||||||
|
{
|
||||||
|
avcodec_register(codec);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
unsigned avcodec_get_edge_width(void)
|
unsigned avcodec_get_edge_width(void)
|
||||||
{
|
{
|
||||||
return EDGE_WIDTH;
|
return EDGE_WIDTH;
|
||||||
@@ -219,6 +226,12 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
|
|||||||
*width=FFALIGN(*width, align);
|
*width=FFALIGN(*width, align);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
|
||||||
|
return av_image_check_size(w, h, 0, av_log_ctx);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
|
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
|
||||||
int i;
|
int i;
|
||||||
int w= s->width;
|
int w= s->width;
|
||||||
@@ -723,6 +736,22 @@ static int64_t guess_correct_pts(AVCodecContext *ctx,
|
|||||||
return pts;
|
return pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_VIDEO_OLD
|
||||||
|
int attribute_align_arg avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
|
||||||
|
int *got_picture_ptr,
|
||||||
|
const uint8_t *buf, int buf_size)
|
||||||
|
{
|
||||||
|
AVPacket avpkt;
|
||||||
|
av_init_packet(&avpkt);
|
||||||
|
avpkt.data = buf;
|
||||||
|
avpkt.size = buf_size;
|
||||||
|
// HACK for CorePNG to decode as normal PNG by default
|
||||||
|
avpkt.flags = AV_PKT_FLAG_KEY;
|
||||||
|
|
||||||
|
return avcodec_decode_video2(avctx, picture, got_picture_ptr, &avpkt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
|
int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
|
||||||
int *got_picture_ptr,
|
int *got_picture_ptr,
|
||||||
AVPacket *avpkt)
|
AVPacket *avpkt)
|
||||||
@@ -734,7 +763,6 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){
|
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){
|
||||||
av_packet_split_side_data(avpkt);
|
|
||||||
avctx->pkt = avpkt;
|
avctx->pkt = avpkt;
|
||||||
if (HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)
|
if (HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)
|
||||||
ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
|
ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
|
||||||
@@ -773,6 +801,20 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_AUDIO_OLD
|
||||||
|
int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
|
||||||
|
int *frame_size_ptr,
|
||||||
|
const uint8_t *buf, int buf_size)
|
||||||
|
{
|
||||||
|
AVPacket avpkt;
|
||||||
|
av_init_packet(&avpkt);
|
||||||
|
avpkt.data = buf;
|
||||||
|
avpkt.size = buf_size;
|
||||||
|
|
||||||
|
return avcodec_decode_audio3(avctx, samples, frame_size_ptr, &avpkt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
|
int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
|
||||||
int *frame_size_ptr,
|
int *frame_size_ptr,
|
||||||
AVPacket *avpkt)
|
AVPacket *avpkt)
|
||||||
@@ -802,6 +844,20 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_SUBTITLE_OLD
|
||||||
|
int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
|
||||||
|
int *got_sub_ptr,
|
||||||
|
const uint8_t *buf, int buf_size)
|
||||||
|
{
|
||||||
|
AVPacket avpkt;
|
||||||
|
av_init_packet(&avpkt);
|
||||||
|
avpkt.data = buf;
|
||||||
|
avpkt.size = buf_size;
|
||||||
|
|
||||||
|
return avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, &avpkt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
||||||
int *got_sub_ptr,
|
int *got_sub_ptr,
|
||||||
AVPacket *avpkt)
|
AVPacket *avpkt)
|
||||||
@@ -1234,6 +1290,20 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
#include "libavutil/parseutils.h"
|
||||||
|
|
||||||
|
int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
|
||||||
|
{
|
||||||
|
return av_parse_video_size(width_ptr, height_ptr, str);
|
||||||
|
}
|
||||||
|
|
||||||
|
int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
|
||||||
|
{
|
||||||
|
return av_parse_video_rate(frame_rate, arg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
|
int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<size && !(tab[i][0]==a && tab[i][1]==b); i++);
|
for(i=0; i<size && !(tab[i][0]==a && tab[i][1]==b); i++);
|
||||||
@@ -1350,4 +1420,12 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count)
|
|||||||
s->thread_count = thread_count;
|
s->thread_count = thread_count;
|
||||||
return ff_thread_init(s);
|
return ff_thread_init(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void avcodec_thread_free(AVCodecContext *s)
|
||||||
|
{
|
||||||
|
#if HAVE_THREADS
|
||||||
|
ff_thread_free(s);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -3716,11 +3716,21 @@ static int vc1_decode_frame(AVCodecContext *avctx,
|
|||||||
if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)){
|
if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)){
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* skip b frames if we are in a hurry */
|
||||||
|
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size;
|
||||||
|
#endif
|
||||||
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
|
||||||
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
|
||||||
|| avctx->skip_frame >= AVDISCARD_ALL) {
|
|| avctx->skip_frame >= AVDISCARD_ALL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
#if FF_API_HURRY_UP
|
||||||
|
/* skip everything if we are in a hurry>=5 */
|
||||||
|
if(avctx->hurry_up>=5) {
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(s->next_p_frame_damaged){
|
if(s->next_p_frame_damaged){
|
||||||
if(s->pict_type==AV_PICTURE_TYPE_B)
|
if(s->pict_type==AV_PICTURE_TYPE_B)
|
||||||
|
@@ -67,13 +67,6 @@ struct vdpau_render_state {
|
|||||||
|
|
||||||
int state; ///< Holds FF_VDPAU_STATE_* values.
|
int state; ///< Holds FF_VDPAU_STATE_* values.
|
||||||
|
|
||||||
/** Describe size/location of the compressed video data.
|
|
||||||
Set to 0 when freeing bitstream_buffers. */
|
|
||||||
int bitstream_buffers_allocated;
|
|
||||||
int bitstream_buffers_used;
|
|
||||||
/** The user is responsible for freeing this buffer using av_freep(). */
|
|
||||||
VdpBitstreamBuffer *bitstream_buffers;
|
|
||||||
|
|
||||||
/** picture parameter information for all supported codecs */
|
/** picture parameter information for all supported codecs */
|
||||||
union VdpPictureInfo {
|
union VdpPictureInfo {
|
||||||
VdpPictureInfoH264 h264;
|
VdpPictureInfoH264 h264;
|
||||||
@@ -81,6 +74,13 @@ struct vdpau_render_state {
|
|||||||
VdpPictureInfoVC1 vc1;
|
VdpPictureInfoVC1 vc1;
|
||||||
VdpPictureInfoMPEG4Part2 mpeg4;
|
VdpPictureInfoMPEG4Part2 mpeg4;
|
||||||
} info;
|
} info;
|
||||||
|
|
||||||
|
/** Describe size/location of the compressed video data.
|
||||||
|
Set to 0 when freeing bitstream_buffers. */
|
||||||
|
int bitstream_buffers_allocated;
|
||||||
|
int bitstream_buffers_used;
|
||||||
|
/** The user is responsible for freeing this buffer using av_freep(). */
|
||||||
|
VdpBitstreamBuffer *bitstream_buffers;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* @}*/
|
/* @}*/
|
||||||
|
@@ -20,8 +20,8 @@
|
|||||||
#ifndef AVCODEC_VERSION_H
|
#ifndef AVCODEC_VERSION_H
|
||||||
#define AVCODEC_VERSION_H
|
#define AVCODEC_VERSION_H
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 53
|
#define LIBAVCODEC_VERSION_MAJOR 52
|
||||||
#define LIBAVCODEC_VERSION_MINOR 7
|
#define LIBAVCODEC_VERSION_MINOR 122
|
||||||
#define LIBAVCODEC_VERSION_MICRO 0
|
#define LIBAVCODEC_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
@@ -41,12 +41,45 @@
|
|||||||
#ifndef FF_API_PALETTE_CONTROL
|
#ifndef FF_API_PALETTE_CONTROL
|
||||||
#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54)
|
#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_MM_FLAGS
|
||||||
|
#define FF_API_MM_FLAGS (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_OPT_SHOW
|
||||||
|
#define FF_API_OPT_SHOW (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_AUDIO_OLD
|
||||||
|
#define FF_API_AUDIO_OLD (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_VIDEO_OLD
|
||||||
|
#define FF_API_VIDEO_OLD (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_SUBTITLE_OLD
|
||||||
|
#define FF_API_SUBTITLE_OLD (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_USE_LPC
|
||||||
|
#define FF_API_USE_LPC (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_SET_STRING_OLD
|
||||||
|
#define FF_API_SET_STRING_OLD (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_INOFFICIAL
|
||||||
|
#define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
#ifndef FF_API_OLD_SAMPLE_FMT
|
#ifndef FF_API_OLD_SAMPLE_FMT
|
||||||
#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54)
|
#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||||
#endif
|
#endif
|
||||||
#ifndef FF_API_OLD_AUDIOCONVERT
|
#ifndef FF_API_OLD_AUDIOCONVERT
|
||||||
#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
|
#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_HURRY_UP
|
||||||
|
#define FF_API_HURRY_UP (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_RATE_EMU
|
||||||
|
#define FF_API_RATE_EMU (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_MB_Q
|
||||||
|
#define FF_API_MB_Q (LIBAVCODEC_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
#ifndef FF_API_ANTIALIAS_ALGO
|
#ifndef FF_API_ANTIALIAS_ALGO
|
||||||
#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
|
#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
|
||||||
#endif
|
#endif
|
||||||
|
@@ -25,6 +25,11 @@
|
|||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
#define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */
|
||||||
|
#define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */
|
||||||
|
#define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */
|
||||||
|
#endif
|
||||||
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
|
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
|
||||||
the number is 1337 speak for the letters IDCT MCo (motion compensation) */
|
the number is 1337 speak for the letters IDCT MCo (motion compensation) */
|
||||||
|
|
||||||
@@ -146,6 +151,22 @@ struct xvmc_pix_fmt {
|
|||||||
of coded blocks it contains.
|
of coded blocks it contains.
|
||||||
*/
|
*/
|
||||||
int next_free_data_block_num;
|
int next_free_data_block_num;
|
||||||
|
|
||||||
|
/** extensions may be placed here */
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 53
|
||||||
|
//@{
|
||||||
|
/** State flags used to work around limitations in the MPlayer video system.
|
||||||
|
0 - Surface is not used.
|
||||||
|
1 - Surface is still held in application to be displayed or is
|
||||||
|
still visible.
|
||||||
|
2 - Surface is still held in libavcodec buffer for prediction.
|
||||||
|
*/
|
||||||
|
int state;
|
||||||
|
|
||||||
|
/** pointer to the surface where the subpicture is rendered */
|
||||||
|
void* p_osd_target_surface_render;
|
||||||
|
//}@
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* AVCODEC_XVMC_H */
|
#endif /* AVCODEC_XVMC_H */
|
||||||
|
@@ -22,9 +22,9 @@
|
|||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
#include "libavformat/avformat.h"
|
#include "libavformat/avformat.h"
|
||||||
|
|
||||||
#define LIBAVDEVICE_VERSION_MAJOR 53
|
#define LIBAVDEVICE_VERSION_MAJOR 52
|
||||||
#define LIBAVDEVICE_VERSION_MINOR 1
|
#define LIBAVDEVICE_VERSION_MINOR 5
|
||||||
#define LIBAVDEVICE_VERSION_MICRO 1
|
#define LIBAVDEVICE_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
|
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
|
||||||
LIBAVDEVICE_VERSION_MINOR, \
|
LIBAVDEVICE_VERSION_MINOR, \
|
||||||
|
@@ -25,8 +25,8 @@
|
|||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
#include "libavutil/samplefmt.h"
|
#include "libavutil/samplefmt.h"
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_MAJOR 2
|
#define LIBAVFILTER_VERSION_MAJOR 1
|
||||||
#define LIBAVFILTER_VERSION_MINOR 23
|
#define LIBAVFILTER_VERSION_MINOR 80
|
||||||
#define LIBAVFILTER_VERSION_MICRO 0
|
#define LIBAVFILTER_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||||
|
@@ -158,7 +158,7 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char *
|
|||||||
}
|
}
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
if (*rows > (SIZE_MAX / sizeof(int) / *cols)) {
|
if (*rows > (FF_INTERNAL_MEM_TYPE_MAX_VALUE / (sizeof(int)) / *cols)) {
|
||||||
av_log(log_ctx, AV_LOG_ERROR, "File with size %dx%d is too big\n",
|
av_log(log_ctx, AV_LOG_ERROR, "File with size %dx%d is too big\n",
|
||||||
*rows, *cols);
|
*rows, *cols);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//FIXME maybe link the orig in
|
//FIXME maybe link the orig in
|
||||||
|
//XXX: identical pix_fmt must be following with each others
|
||||||
static const struct {
|
static const struct {
|
||||||
int fmt;
|
int fmt;
|
||||||
enum PixelFormat pix_fmt;
|
enum PixelFormat pix_fmt;
|
||||||
@@ -785,13 +786,17 @@ static int query_formats(AVFilterContext *ctx)
|
|||||||
{
|
{
|
||||||
AVFilterFormats *avfmts=NULL;
|
AVFilterFormats *avfmts=NULL;
|
||||||
MPContext *m = ctx->priv;
|
MPContext *m = ctx->priv;
|
||||||
|
enum PixelFormat lastpixfmt = PIX_FMT_NONE;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; conversion_map[i].fmt; i++){
|
for(i=0; conversion_map[i].fmt; i++){
|
||||||
av_log(ctx, AV_LOG_DEBUG, "query: %X\n", conversion_map[i].fmt);
|
av_log(ctx, AV_LOG_DEBUG, "query: %X\n", conversion_map[i].fmt);
|
||||||
if(m->vf.query_format(&m->vf, conversion_map[i].fmt)){
|
if(m->vf.query_format(&m->vf, conversion_map[i].fmt)){
|
||||||
av_log(ctx, AV_LOG_DEBUG, "supported,adding\n");
|
av_log(ctx, AV_LOG_DEBUG, "supported,adding\n");
|
||||||
avfilter_add_format(&avfmts, conversion_map[i].pix_fmt);
|
if (conversion_map[i].pix_fmt != lastpixfmt) {
|
||||||
|
avfilter_add_format(&avfmts, conversion_map[i].pix_fmt);
|
||||||
|
lastpixfmt = conversion_map[i].pix_fmt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,6 +10,7 @@ OBJS = allformats.o \
|
|||||||
id3v1.o \
|
id3v1.o \
|
||||||
id3v2.o \
|
id3v2.o \
|
||||||
metadata.o \
|
metadata.o \
|
||||||
|
metadata_compat.o \
|
||||||
options.o \
|
options.o \
|
||||||
os_support.o \
|
os_support.o \
|
||||||
sdp.o \
|
sdp.o \
|
||||||
|
@@ -208,7 +208,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
|
|||||||
|
|
||||||
if (!in) {
|
if (!in) {
|
||||||
close_in = 1;
|
close_in = 1;
|
||||||
if ((ret = avio_open(&in, url, AVIO_FLAG_READ)) < 0)
|
if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,13 +321,13 @@ static int open_input(struct variant *var)
|
|||||||
{
|
{
|
||||||
struct segment *seg = var->segments[var->cur_seq_no - var->start_seq_no];
|
struct segment *seg = var->segments[var->cur_seq_no - var->start_seq_no];
|
||||||
if (seg->key_type == KEY_NONE) {
|
if (seg->key_type == KEY_NONE) {
|
||||||
return ffurl_open(&var->input, seg->url, AVIO_FLAG_READ);
|
return ffurl_open(&var->input, seg->url, AVIO_RDONLY);
|
||||||
} else if (seg->key_type == KEY_AES_128) {
|
} else if (seg->key_type == KEY_AES_128) {
|
||||||
char iv[33], key[33], url[MAX_URL_SIZE];
|
char iv[33], key[33], url[MAX_URL_SIZE];
|
||||||
int ret;
|
int ret;
|
||||||
if (strcmp(seg->key, var->key_url)) {
|
if (strcmp(seg->key, var->key_url)) {
|
||||||
URLContext *uc;
|
URLContext *uc;
|
||||||
if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ) == 0) {
|
if (ffurl_open(&uc, seg->key, AVIO_RDONLY) == 0) {
|
||||||
if (ffurl_read_complete(uc, var->key, sizeof(var->key))
|
if (ffurl_read_complete(uc, var->key, sizeof(var->key))
|
||||||
!= sizeof(var->key)) {
|
!= sizeof(var->key)) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
|
av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
|
||||||
@@ -347,7 +347,7 @@ static int open_input(struct variant *var)
|
|||||||
snprintf(url, sizeof(url), "crypto+%s", seg->url);
|
snprintf(url, sizeof(url), "crypto+%s", seg->url);
|
||||||
else
|
else
|
||||||
snprintf(url, sizeof(url), "crypto:%s", seg->url);
|
snprintf(url, sizeof(url), "crypto:%s", seg->url);
|
||||||
if ((ret = ffurl_alloc(&var->input, url, AVIO_FLAG_READ)) < 0)
|
if ((ret = ffurl_alloc(&var->input, url, AVIO_RDONLY)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
av_set_string3(var->input->priv_data, "key", key, 0, NULL);
|
av_set_string3(var->input->priv_data, "key", key, 0, NULL);
|
||||||
av_set_string3(var->input->priv_data, "iv", iv, 0, NULL);
|
av_set_string3(var->input->priv_data, "iv", iv, 0, NULL);
|
||||||
@@ -395,7 +395,9 @@ reload:
|
|||||||
goto reload;
|
goto reload;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = open_input(v);
|
ret = ffurl_open(&v->input,
|
||||||
|
v->segments[v->cur_seq_no - v->start_seq_no]->url,
|
||||||
|
AVIO_RDONLY);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -114,7 +114,7 @@ static int parse_playlist(URLContext *h, const char *url)
|
|||||||
char line[1024];
|
char line[1024];
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
|
|
||||||
if ((ret = avio_open(&in, url, AVIO_FLAG_READ)) < 0)
|
if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
read_chomp_line(in, line, sizeof(line));
|
read_chomp_line(in, line, sizeof(line));
|
||||||
@@ -179,7 +179,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
|
|||||||
int ret, i;
|
int ret, i;
|
||||||
const char *nested_url;
|
const char *nested_url;
|
||||||
|
|
||||||
if (flags & AVIO_FLAG_WRITE)
|
if (flags & (AVIO_WRONLY | AVIO_RDWR))
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
|
|
||||||
s = av_mallocz(sizeof(AppleHTTPContext));
|
s = av_mallocz(sizeof(AppleHTTPContext));
|
||||||
@@ -194,7 +194,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
|
|||||||
av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl));
|
av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl));
|
||||||
av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl));
|
av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl));
|
||||||
} else {
|
} else {
|
||||||
av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri);
|
av_log(NULL, AV_LOG_ERROR, "Unsupported url %s\n", uri);
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s->n_segments == 0) {
|
if (s->n_segments == 0) {
|
||||||
av_log(h, AV_LOG_WARNING, "Empty playlist\n");
|
av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
|
||||||
ret = AVERROR(EIO);
|
ret = AVERROR(EIO);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ retry:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (s->cur_seq_no < s->start_seq_no) {
|
if (s->cur_seq_no < s->start_seq_no) {
|
||||||
av_log(h, AV_LOG_WARNING,
|
av_log(NULL, AV_LOG_WARNING,
|
||||||
"skipping %d segments ahead, expired from playlist\n",
|
"skipping %d segments ahead, expired from playlist\n",
|
||||||
s->start_seq_no - s->cur_seq_no);
|
s->start_seq_no - s->cur_seq_no);
|
||||||
s->cur_seq_no = s->start_seq_no;
|
s->cur_seq_no = s->start_seq_no;
|
||||||
@@ -273,12 +273,12 @@ retry:
|
|||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
|
url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
|
||||||
av_log(h, AV_LOG_DEBUG, "opening %s\n", url);
|
av_log(NULL, AV_LOG_DEBUG, "opening %s\n", url);
|
||||||
ret = ffurl_open(&s->seg_hd, url, AVIO_FLAG_READ);
|
ret = ffurl_open(&s->seg_hd, url, AVIO_RDONLY);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (url_interrupt_cb())
|
if (url_interrupt_cb())
|
||||||
return AVERROR_EXIT;
|
return AVERROR_EXIT;
|
||||||
av_log(h, AV_LOG_WARNING, "Unable to open %s\n", url);
|
av_log(NULL, AV_LOG_WARNING, "Unable to open %s\n", url);
|
||||||
s->cur_seq_no++;
|
s->cur_seq_no++;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@@ -45,8 +45,6 @@ typedef struct {
|
|||||||
|
|
||||||
uint16_t stream_language_index;
|
uint16_t stream_language_index;
|
||||||
|
|
||||||
int palette_changed;
|
|
||||||
uint32_t palette[256];
|
|
||||||
} ASFStream;
|
} ASFStream;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@@ -359,14 +359,15 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
|||||||
/* This is true for all paletted codecs implemented in ffmpeg */
|
/* This is true for all paletted codecs implemented in ffmpeg */
|
||||||
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
|
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
|
||||||
int av_unused i;
|
int av_unused i;
|
||||||
|
st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
|
||||||
#if HAVE_BIGENDIAN
|
#if HAVE_BIGENDIAN
|
||||||
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
|
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
|
||||||
asf_st->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
|
st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
|
||||||
#else
|
#else
|
||||||
memcpy(asf_st->palette, st->codec->extradata,
|
memcpy(st->codec->palctrl->palette, st->codec->extradata,
|
||||||
FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
|
FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
|
||||||
#endif
|
#endif
|
||||||
asf_st->palette_changed = 1;
|
st->codec->palctrl->palette_changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
st->codec->codec_tag = tag1;
|
st->codec->codec_tag = tag1;
|
||||||
@@ -970,17 +971,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
|||||||
asf_st->pkt.stream_index = asf->stream_index;
|
asf_st->pkt.stream_index = asf->stream_index;
|
||||||
asf_st->pkt.pos =
|
asf_st->pkt.pos =
|
||||||
asf_st->packet_pos= asf->packet_pos;
|
asf_st->packet_pos= asf->packet_pos;
|
||||||
if (asf_st->pkt.data && asf_st->palette_changed) {
|
|
||||||
uint8_t *pal;
|
|
||||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
|
|
||||||
AVPALETTE_SIZE);
|
|
||||||
if (!pal) {
|
|
||||||
av_log(s, AV_LOG_ERROR, "Cannot append palette to packet\n");
|
|
||||||
} else {
|
|
||||||
memcpy(pal, asf_st->palette, AVPALETTE_SIZE);
|
|
||||||
asf_st->palette_changed = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
|
//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
|
||||||
//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY,
|
//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY,
|
||||||
//s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size);
|
//s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size);
|
||||||
@@ -1137,8 +1127,14 @@ static void asf_reset_header(AVFormatContext *s)
|
|||||||
|
|
||||||
static int asf_read_close(AVFormatContext *s)
|
static int asf_read_close(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
asf_reset_header(s);
|
asf_reset_header(s);
|
||||||
|
|
||||||
|
for(i=0;i<s->nb_streams;i++) {
|
||||||
|
AVStream *st = s->streams[i];
|
||||||
|
av_free(st->codec->palctrl);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -137,6 +137,20 @@ typedef struct AVMetadataConv AVMetadataConv;
|
|||||||
attribute_deprecated AVDictionaryEntry *
|
attribute_deprecated AVDictionaryEntry *
|
||||||
av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
|
av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
|
||||||
|
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
/**
|
||||||
|
* Set the given tag in *pm, overwriting an existing tag.
|
||||||
|
*
|
||||||
|
* @param pm pointer to a pointer to a metadata struct. If *pm is NULL
|
||||||
|
* a metadata struct is allocated and put in *pm.
|
||||||
|
* @param key tag key to add to *pm (will be av_strduped)
|
||||||
|
* @param value tag value to add to *pm (will be av_strduped)
|
||||||
|
* @return >= 0 on success otherwise an error code <0
|
||||||
|
* @deprecated Use av_metadata_set2() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the given tag in *pm, overwriting an existing tag.
|
* Set the given tag in *pm, overwriting an existing tag.
|
||||||
*
|
*
|
||||||
@@ -249,6 +263,10 @@ typedef struct AVFormatParameters {
|
|||||||
immediately (RTSP only). */
|
immediately (RTSP only). */
|
||||||
attribute_deprecated unsigned int prealloced_context:1;
|
attribute_deprecated unsigned int prealloced_context:1;
|
||||||
#endif
|
#endif
|
||||||
|
#if FF_API_PARAMETERS_CODEC_ID
|
||||||
|
attribute_deprecated enum CodecID video_codec_id;
|
||||||
|
attribute_deprecated enum CodecID audio_codec_id;
|
||||||
|
#endif
|
||||||
} AVFormatParameters;
|
} AVFormatParameters;
|
||||||
|
|
||||||
//! Demuxer will use avio_open, no opened file should be provided by the caller.
|
//! Demuxer will use avio_open, no opened file should be provided by the caller.
|
||||||
@@ -541,6 +559,10 @@ typedef struct AVStream {
|
|||||||
*/
|
*/
|
||||||
int64_t duration;
|
int64_t duration;
|
||||||
|
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
attribute_deprecated char language[4]; /**< ISO 639-2/B 3-letter language code (empty string if undefined) */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* av_read_frame() support */
|
/* av_read_frame() support */
|
||||||
enum AVStreamParseType need_parsing;
|
enum AVStreamParseType need_parsing;
|
||||||
struct AVCodecParserContext *parser;
|
struct AVCodecParserContext *parser;
|
||||||
@@ -556,6 +578,14 @@ typedef struct AVStream {
|
|||||||
|
|
||||||
int64_t nb_frames; ///< number of frames in this stream if known or 0
|
int64_t nb_frames; ///< number of frames in this stream if known or 0
|
||||||
|
|
||||||
|
#if FF_API_LAVF_UNUSED
|
||||||
|
attribute_deprecated int64_t unused[4+1];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
attribute_deprecated char *filename; /**< source filename of the stream */
|
||||||
|
#endif
|
||||||
|
|
||||||
int disposition; /**< AV_DISPOSITION_* bit field */
|
int disposition; /**< AV_DISPOSITION_* bit field */
|
||||||
|
|
||||||
AVProbeData probe_data;
|
AVProbeData probe_data;
|
||||||
@@ -646,6 +676,10 @@ typedef struct AVStream {
|
|||||||
*/
|
*/
|
||||||
typedef struct AVProgram {
|
typedef struct AVProgram {
|
||||||
int id;
|
int id;
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
attribute_deprecated char *provider_name; ///< network name for DVB streams
|
||||||
|
attribute_deprecated char *name; ///< service name for DVB streams
|
||||||
|
#endif
|
||||||
int flags;
|
int flags;
|
||||||
enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller
|
enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller
|
||||||
unsigned int *stream_index;
|
unsigned int *stream_index;
|
||||||
@@ -664,9 +698,16 @@ typedef struct AVChapter {
|
|||||||
int id; ///< unique ID to identify the chapter
|
int id; ///< unique ID to identify the chapter
|
||||||
AVRational time_base; ///< time base in which the start/end timestamps are specified
|
AVRational time_base; ///< time base in which the start/end timestamps are specified
|
||||||
int64_t start, end; ///< chapter start/end time in time_base units
|
int64_t start, end; ///< chapter start/end time in time_base units
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
attribute_deprecated char *title; ///< chapter title
|
||||||
|
#endif
|
||||||
AVDictionary *metadata;
|
AVDictionary *metadata;
|
||||||
} AVChapter;
|
} AVChapter;
|
||||||
|
|
||||||
|
#if FF_API_MAX_STREAMS
|
||||||
|
#define MAX_STREAMS 20
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format I/O context.
|
* Format I/O context.
|
||||||
* New fields can be added to the end with minor version bumps.
|
* New fields can be added to the end with minor version bumps.
|
||||||
@@ -682,10 +723,24 @@ typedef struct AVFormatContext {
|
|||||||
void *priv_data;
|
void *priv_data;
|
||||||
AVIOContext *pb;
|
AVIOContext *pb;
|
||||||
unsigned int nb_streams;
|
unsigned int nb_streams;
|
||||||
|
#if FF_API_MAX_STREAMS
|
||||||
|
AVStream *streams[MAX_STREAMS];
|
||||||
|
#else
|
||||||
AVStream **streams;
|
AVStream **streams;
|
||||||
|
#endif
|
||||||
char filename[1024]; /**< input or output filename */
|
char filename[1024]; /**< input or output filename */
|
||||||
/* stream info */
|
/* stream info */
|
||||||
int64_t timestamp;
|
int64_t timestamp;
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
attribute_deprecated char title[512];
|
||||||
|
attribute_deprecated char author[512];
|
||||||
|
attribute_deprecated char copyright[512];
|
||||||
|
attribute_deprecated char comment[512];
|
||||||
|
attribute_deprecated char album[512];
|
||||||
|
attribute_deprecated int year; /**< ID3 year, 0 if none */
|
||||||
|
attribute_deprecated int track; /**< track number, 0 if none */
|
||||||
|
attribute_deprecated char genre[32]; /**< ID3 genre */
|
||||||
|
#endif
|
||||||
|
|
||||||
int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
|
int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
|
||||||
/* private data for pts handling (do not modify directly). */
|
/* private data for pts handling (do not modify directly). */
|
||||||
@@ -725,9 +780,17 @@ typedef struct AVFormatContext {
|
|||||||
|
|
||||||
/* av_read_frame() support */
|
/* av_read_frame() support */
|
||||||
AVStream *cur_st;
|
AVStream *cur_st;
|
||||||
|
#if FF_API_LAVF_UNUSED
|
||||||
|
const uint8_t *cur_ptr_deprecated;
|
||||||
|
int cur_len_deprecated;
|
||||||
|
AVPacket cur_pkt_deprecated;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* av_seek_frame() support */
|
/* av_seek_frame() support */
|
||||||
int64_t data_offset; /**< offset of the first packet */
|
int64_t data_offset; /**< offset of the first packet */
|
||||||
|
#if FF_API_INDEX_BUILT
|
||||||
|
attribute_deprecated int index_built;
|
||||||
|
#endif
|
||||||
|
|
||||||
int mux_rate;
|
int mux_rate;
|
||||||
unsigned int packet_size;
|
unsigned int packet_size;
|
||||||
@@ -867,6 +930,11 @@ typedef struct AVPacketList {
|
|||||||
struct AVPacketList *next;
|
struct AVPacketList *next;
|
||||||
} AVPacketList;
|
} AVPacketList;
|
||||||
|
|
||||||
|
#if FF_API_FIRST_FORMAT
|
||||||
|
attribute_deprecated extern AVInputFormat *first_iformat;
|
||||||
|
attribute_deprecated extern AVOutputFormat *first_oformat;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If f is NULL, returns the first registered input format,
|
* If f is NULL, returns the first registered input format,
|
||||||
* if f is non-NULL, returns the next registered input format after f
|
* if f is non-NULL, returns the next registered input format after f
|
||||||
@@ -891,6 +959,18 @@ attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename);
|
|||||||
/* utils.c */
|
/* utils.c */
|
||||||
void av_register_input_format(AVInputFormat *format);
|
void av_register_input_format(AVInputFormat *format);
|
||||||
void av_register_output_format(AVOutputFormat *format);
|
void av_register_output_format(AVOutputFormat *format);
|
||||||
|
#if FF_API_GUESS_FORMAT
|
||||||
|
attribute_deprecated AVOutputFormat *guess_stream_format(const char *short_name,
|
||||||
|
const char *filename,
|
||||||
|
const char *mime_type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use av_guess_format() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated AVOutputFormat *guess_format(const char *short_name,
|
||||||
|
const char *filename,
|
||||||
|
const char *mime_type);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the output format in the list of registered output formats
|
* Return the output format in the list of registered output formats
|
||||||
@@ -1107,6 +1187,12 @@ attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char
|
|||||||
*/
|
*/
|
||||||
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
|
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
|
||||||
|
|
||||||
|
#if FF_API_ALLOC_FORMAT_CONTEXT
|
||||||
|
/**
|
||||||
|
* @deprecated Use avformat_alloc_context() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated AVFormatContext *av_alloc_format_context(void);
|
||||||
|
#endif
|
||||||
int av_demuxer_open(AVFormatContext *ic, AVFormatParameters *ap);
|
int av_demuxer_open(AVFormatContext *ic, AVFormatParameters *ap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1533,6 +1619,22 @@ void av_dump_format(AVFormatContext *ic,
|
|||||||
const char *url,
|
const char *url,
|
||||||
int is_output);
|
int is_output);
|
||||||
|
|
||||||
|
#if FF_API_PARSE_FRAME_PARAM
|
||||||
|
/**
|
||||||
|
* Parse width and height out of string str.
|
||||||
|
* @deprecated Use av_parse_video_frame_size instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr,
|
||||||
|
const char *str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert framerate from a string to a fraction.
|
||||||
|
* @deprecated Use av_parse_video_frame_rate instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
|
||||||
|
const char *arg);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FF_API_PARSE_DATE
|
#if FF_API_PARSE_DATE
|
||||||
/**
|
/**
|
||||||
* Parse datestr and return a corresponding number of microseconds.
|
* Parse datestr and return a corresponding number of microseconds.
|
||||||
|
@@ -606,18 +606,15 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
/* This code assumes that extradata contains only palette. */
|
/* This code assumes that extradata contains only palette. */
|
||||||
/* This is true for all paletted codecs implemented in FFmpeg. */
|
/* This is true for all paletted codecs implemented in FFmpeg. */
|
||||||
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
|
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
|
||||||
int pal_size = (1 << st->codec->bits_per_coded_sample) << 2;
|
st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
|
||||||
const uint8_t *pal_src;
|
|
||||||
|
|
||||||
pal_size = FFMIN(pal_size, st->codec->extradata_size);
|
|
||||||
pal_src = st->codec->extradata + st->codec->extradata_size - pal_size;
|
|
||||||
#if HAVE_BIGENDIAN
|
#if HAVE_BIGENDIAN
|
||||||
for (i = 0; i < pal_size/4; i++)
|
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
|
||||||
ast->pal[i] = AV_RL32(pal_src+4*i);
|
st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
|
||||||
#else
|
#else
|
||||||
memcpy(ast->pal, pal_src, pal_size);
|
memcpy(st->codec->palctrl->palette, st->codec->extradata,
|
||||||
|
FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
|
||||||
#endif
|
#endif
|
||||||
ast->has_pal = 1;
|
st->codec->palctrl->palette_changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_tag("video", tag1, 0);
|
print_tag("video", tag1, 0);
|
||||||
@@ -959,14 +956,14 @@ resync:
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){
|
if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){
|
||||||
uint8_t *pal;
|
void *ptr= av_realloc(pkt->data, pkt->size + 4*256 + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
|
if(ptr){
|
||||||
if(!pal){
|
ast->has_pal=0;
|
||||||
av_log(s, AV_LOG_ERROR, "Failed to allocate data for palette\n");
|
pkt->size += 4*256;
|
||||||
}else{
|
pkt->data= ptr;
|
||||||
memcpy(pal, ast->pal, AVPALETTE_SIZE);
|
memcpy(pkt->data + pkt->size - 4*256, ast->pal, 4*256);
|
||||||
ast->has_pal = 0;
|
}else
|
||||||
}
|
av_log(s, AV_LOG_ERROR, "Failed to append palette\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
||||||
@@ -1393,6 +1390,7 @@ static int avi_read_close(AVFormatContext *s)
|
|||||||
for(i=0;i<s->nb_streams;i++) {
|
for(i=0;i<s->nb_streams;i++) {
|
||||||
AVStream *st = s->streams[i];
|
AVStream *st = s->streams[i];
|
||||||
AVIStream *ast = st->priv_data;
|
AVIStream *ast = st->priv_data;
|
||||||
|
av_free(st->codec->palctrl);
|
||||||
if (ast) {
|
if (ast) {
|
||||||
if (ast->sub_ctx) {
|
if (ast->sub_ctx) {
|
||||||
av_freep(&ast->sub_ctx->pb);
|
av_freep(&ast->sub_ctx->pb);
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
|
|
||||||
|
#if FF_API_URL_CLASS
|
||||||
/** @name Logging context. */
|
/** @name Logging context. */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
static const char *urlcontext_to_name(void *ptr)
|
static const char *urlcontext_to_name(void *ptr)
|
||||||
@@ -46,6 +47,7 @@ static const AVClass urlcontext_class = {
|
|||||||
.version = LIBAVUTIL_VERSION_INT,
|
.version = LIBAVUTIL_VERSION_INT,
|
||||||
};
|
};
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
#endif
|
||||||
|
|
||||||
static int default_interrupt_cb(void);
|
static int default_interrupt_cb(void);
|
||||||
|
|
||||||
@@ -83,6 +85,29 @@ int ffurl_register_protocol(URLProtocol *protocol, int size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_REGISTER_PROTOCOL
|
||||||
|
/* The layout of URLProtocol as of when major was bumped to 52 */
|
||||||
|
struct URLProtocol_compat {
|
||||||
|
const char *name;
|
||||||
|
int (*url_open)(URLContext *h, const char *filename, int flags);
|
||||||
|
int (*url_read)(URLContext *h, unsigned char *buf, int size);
|
||||||
|
int (*url_write)(URLContext *h, unsigned char *buf, int size);
|
||||||
|
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
|
||||||
|
int (*url_close)(URLContext *h);
|
||||||
|
struct URLProtocol *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
int av_register_protocol(URLProtocol *protocol)
|
||||||
|
{
|
||||||
|
return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat));
|
||||||
|
}
|
||||||
|
|
||||||
|
int register_protocol(URLProtocol *protocol)
|
||||||
|
{
|
||||||
|
return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
||||||
const char *filename, int flags)
|
const char *filename, int flags)
|
||||||
{
|
{
|
||||||
@@ -98,7 +123,9 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
|||||||
err = AVERROR(ENOMEM);
|
err = AVERROR(ENOMEM);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
#if FF_API_URL_CLASS
|
||||||
uc->av_class = &urlcontext_class;
|
uc->av_class = &urlcontext_class;
|
||||||
|
#endif
|
||||||
uc->filename = (char *) &uc[1];
|
uc->filename = (char *) &uc[1];
|
||||||
strcpy(uc->filename, filename);
|
strcpy(uc->filename, filename);
|
||||||
uc->prot = up;
|
uc->prot = up;
|
||||||
@@ -130,7 +157,7 @@ int ffurl_connect(URLContext* uc)
|
|||||||
return err;
|
return err;
|
||||||
uc->is_connected = 1;
|
uc->is_connected = 1;
|
||||||
//We must be careful here as ffurl_seek() could be slow, for example for http
|
//We must be careful here as ffurl_seek() could be slow, for example for http
|
||||||
if( (uc->flags & AVIO_FLAG_WRITE)
|
if( (uc->flags & (AVIO_WRONLY | AVIO_RDWR))
|
||||||
|| !strcmp(uc->prot->name, "file"))
|
|| !strcmp(uc->prot->name, "file"))
|
||||||
if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
|
if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
|
||||||
uc->is_streamed= 1;
|
uc->is_streamed= 1;
|
||||||
@@ -290,21 +317,21 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
|
|||||||
|
|
||||||
int ffurl_read(URLContext *h, unsigned char *buf, int size)
|
int ffurl_read(URLContext *h, unsigned char *buf, int size)
|
||||||
{
|
{
|
||||||
if (!(h->flags & AVIO_FLAG_READ))
|
if (h->flags & AVIO_WRONLY)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
|
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
|
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
|
||||||
{
|
{
|
||||||
if (!(h->flags & AVIO_FLAG_READ))
|
if (h->flags & AVIO_WRONLY)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
|
return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
|
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
|
||||||
{
|
{
|
||||||
if (!(h->flags & AVIO_FLAG_WRITE))
|
if (!(h->flags & (AVIO_WRONLY | AVIO_RDWR)))
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
/* avoid sending too big packets */
|
/* avoid sending too big packets */
|
||||||
if (h->max_packet_size && size > h->max_packet_size)
|
if (h->max_packet_size && size > h->max_packet_size)
|
||||||
@@ -343,7 +370,7 @@ int ffurl_close(URLContext *h)
|
|||||||
int url_exist(const char *filename)
|
int url_exist(const char *filename)
|
||||||
{
|
{
|
||||||
URLContext *h;
|
URLContext *h;
|
||||||
if (ffurl_open(&h, filename, AVIO_FLAG_READ) < 0)
|
if (ffurl_open(&h, filename, AVIO_RDONLY) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
ffurl_close(h);
|
ffurl_close(h);
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -101,7 +101,9 @@ typedef struct {
|
|||||||
* @deprecated This struct will be made private
|
* @deprecated This struct will be made private
|
||||||
*/
|
*/
|
||||||
typedef struct URLContext {
|
typedef struct URLContext {
|
||||||
|
#if FF_API_URL_CLASS
|
||||||
const AVClass *av_class; ///< information for av_log(). Set by url_open().
|
const AVClass *av_class; ///< information for av_log(). Set by url_open().
|
||||||
|
#endif
|
||||||
struct URLProtocol *prot;
|
struct URLProtocol *prot;
|
||||||
int flags;
|
int flags;
|
||||||
int is_streamed; /**< true if streamed (no seek possible), default = false */
|
int is_streamed; /**< true if streamed (no seek possible), default = false */
|
||||||
@@ -150,9 +152,9 @@ attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
|
|||||||
* constants, optionally ORed with other flags.
|
* constants, optionally ORed with other flags.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define URL_RDONLY 1 /**< read-only */
|
#define URL_RDONLY 0 /**< read-only */
|
||||||
#define URL_WRONLY 2 /**< write-only */
|
#define URL_WRONLY 1 /**< write-only */
|
||||||
#define URL_RDWR (URL_RDONLY|URL_WRONLY) /**< read-write */
|
#define URL_RDWR 2 /**< read-write */
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -344,7 +346,7 @@ attribute_deprecated int url_exist(const char *url);
|
|||||||
#endif // FF_API_OLD_AVIO
|
#endif // FF_API_OLD_AVIO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return AVIO_FLAG_* access flags corresponding to the access permissions
|
* Return AVIO_* access flags corresponding to the access permissions
|
||||||
* of the resource in url, or a negative value corresponding to an
|
* of the resource in url, or a negative value corresponding to an
|
||||||
* AVERROR code in case of failure. The returned access flags are
|
* AVERROR code in case of failure. The returned access flags are
|
||||||
* masked by the value in flags.
|
* masked by the value in flags.
|
||||||
@@ -354,6 +356,9 @@ attribute_deprecated int url_exist(const char *url);
|
|||||||
* one call to another. Thus you should not trust the returned value,
|
* one call to another. Thus you should not trust the returned value,
|
||||||
* unless you are sure that no other processes are accessing the
|
* unless you are sure that no other processes are accessing the
|
||||||
* checked resource.
|
* checked resource.
|
||||||
|
*
|
||||||
|
* @note This function is slightly broken until next major bump
|
||||||
|
* because of AVIO_RDONLY == 0. Don't use it until then.
|
||||||
*/
|
*/
|
||||||
int avio_check(const char *url, int flags);
|
int avio_check(const char *url, int flags);
|
||||||
|
|
||||||
@@ -365,6 +370,22 @@ int avio_check(const char *url, int flags);
|
|||||||
*/
|
*/
|
||||||
void avio_set_interrupt_cb(int (*interrupt_cb)(void));
|
void avio_set_interrupt_cb(int (*interrupt_cb)(void));
|
||||||
|
|
||||||
|
#if FF_API_REGISTER_PROTOCOL
|
||||||
|
extern URLProtocol *first_protocol;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FF_API_REGISTER_PROTOCOL
|
||||||
|
/**
|
||||||
|
* @deprecated Use av_register_protocol() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int register_protocol(URLProtocol *protocol);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use av_register_protocol2() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated int av_register_protocol(URLProtocol *protocol);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate and initialize an AVIOContext for buffered I/O. It must be later
|
* Allocate and initialize an AVIOContext for buffered I/O. It must be later
|
||||||
* freed with av_free().
|
* freed with av_free().
|
||||||
@@ -522,15 +543,29 @@ int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
|||||||
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||||
|
|
||||||
|
|
||||||
|
#if FF_API_URL_RESETBUF
|
||||||
|
/** Reset the buffer for reading or writing.
|
||||||
|
* @note Will drop any data currently in the buffer without transmitting it.
|
||||||
|
* @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
|
||||||
|
* to set up the buffer for writing. */
|
||||||
|
int url_resetbuf(AVIOContext *s, int flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup open_modes URL open modes
|
* @defgroup open_modes URL open modes
|
||||||
* The flags argument to avio_open must be one of the following
|
* The flags argument to avio_open must be one of the following
|
||||||
* constants, optionally ORed with other flags.
|
* constants, optionally ORed with other flags.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define AVIO_FLAG_READ 1 /**< read-only */
|
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||||
#define AVIO_FLAG_WRITE 2 /**< write-only */
|
#define AVIO_RDONLY 0 /**< read-only */
|
||||||
#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */
|
#define AVIO_WRONLY 1 /**< write-only */
|
||||||
|
#define AVIO_RDWR 2 /**< read-write */
|
||||||
|
#else
|
||||||
|
#define AVIO_RDONLY 1 /**< read-only */
|
||||||
|
#define AVIO_WRONLY 2 /**< write-only */
|
||||||
|
#define AVIO_RDWR 4 /**< read-write */
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -547,7 +582,11 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
|||||||
* Warning: non-blocking protocols is work-in-progress; this flag may be
|
* Warning: non-blocking protocols is work-in-progress; this flag may be
|
||||||
* silently ignored.
|
* silently ignored.
|
||||||
*/
|
*/
|
||||||
|
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||||
|
#define AVIO_FLAG_NONBLOCK 4
|
||||||
|
#else
|
||||||
#define AVIO_FLAG_NONBLOCK 8
|
#define AVIO_FLAG_NONBLOCK 8
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and initialize a AVIOContext for accessing the
|
* Create and initialize a AVIOContext for accessing the
|
||||||
@@ -591,6 +630,10 @@ int avio_open_dyn_buf(AVIOContext **s);
|
|||||||
*/
|
*/
|
||||||
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||||
|
|
||||||
|
#if FF_API_UDP_GET_FILE
|
||||||
|
int udp_get_file_handle(URLContext *h);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through names of available protocols.
|
* Iterate through names of available protocols.
|
||||||
* @note it is recommanded to use av_protocol_next() instead of this
|
* @note it is recommanded to use av_protocol_next() instead of this
|
||||||
|
@@ -38,7 +38,9 @@
|
|||||||
#define SHORT_SEEK_THRESHOLD 4096
|
#define SHORT_SEEK_THRESHOLD 4096
|
||||||
|
|
||||||
static void fill_buffer(AVIOContext *s);
|
static void fill_buffer(AVIOContext *s);
|
||||||
|
#if !FF_API_URL_RESETBUF
|
||||||
static int url_resetbuf(AVIOContext *s, int flags);
|
static int url_resetbuf(AVIOContext *s, int flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
int ffio_init_context(AVIOContext *s,
|
int ffio_init_context(AVIOContext *s,
|
||||||
unsigned char *buffer,
|
unsigned char *buffer,
|
||||||
@@ -53,7 +55,7 @@ int ffio_init_context(AVIOContext *s,
|
|||||||
s->buffer_size = buffer_size;
|
s->buffer_size = buffer_size;
|
||||||
s->buf_ptr = buffer;
|
s->buf_ptr = buffer;
|
||||||
s->opaque = opaque;
|
s->opaque = opaque;
|
||||||
url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
|
url_resetbuf(s, write_flag ? AVIO_WRONLY : AVIO_RDONLY);
|
||||||
s->write_packet = write_packet;
|
s->write_packet = write_packet;
|
||||||
s->read_packet = read_packet;
|
s->read_packet = read_packet;
|
||||||
s->seek = seek;
|
s->seek = seek;
|
||||||
@@ -854,7 +856,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ffio_init_context(*s, buffer, buffer_size,
|
if (ffio_init_context(*s, buffer, buffer_size,
|
||||||
h->flags & AVIO_FLAG_WRITE, h,
|
(h->flags & AVIO_WRONLY || h->flags & AVIO_RDWR), h,
|
||||||
(void*)ffurl_read, (void*)ffurl_write, (void*)ffurl_seek) < 0) {
|
(void*)ffurl_read, (void*)ffurl_write, (void*)ffurl_seek) < 0) {
|
||||||
av_free(buffer);
|
av_free(buffer);
|
||||||
av_freep(s);
|
av_freep(s);
|
||||||
@@ -883,15 +885,24 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size)
|
|||||||
s->buffer = buffer;
|
s->buffer = buffer;
|
||||||
s->buffer_size = buf_size;
|
s->buffer_size = buf_size;
|
||||||
s->buf_ptr = buffer;
|
s->buf_ptr = buffer;
|
||||||
url_resetbuf(s, s->write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
|
url_resetbuf(s, s->write_flag ? AVIO_WRONLY : AVIO_RDONLY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_URL_RESETBUF
|
||||||
|
int url_resetbuf(AVIOContext *s, int flags)
|
||||||
|
#else
|
||||||
static int url_resetbuf(AVIOContext *s, int flags)
|
static int url_resetbuf(AVIOContext *s, int flags)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
assert(flags == AVIO_FLAG_WRITE || flags == AVIO_FLAG_READ);
|
#if FF_API_URL_RESETBUF
|
||||||
|
if (flags & AVIO_RDWR)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
#else
|
||||||
|
assert(flags == AVIO_WRONLY || flags == AVIO_RDONLY);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (flags & AVIO_FLAG_WRITE) {
|
if (flags & AVIO_WRONLY) {
|
||||||
s->buf_end = s->buffer + s->buffer_size;
|
s->buf_end = s->buffer + s->buffer_size;
|
||||||
s->write_flag = 1;
|
s->write_flag = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -1049,7 +1060,7 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
|
|||||||
if(!*s)
|
if(!*s)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
ret = ffio_init_context(*s, buf, buf_size,
|
ret = ffio_init_context(*s, buf, buf_size,
|
||||||
flags & AVIO_FLAG_WRITE,
|
(flags & AVIO_WRONLY || flags & AVIO_RDWR),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
av_freep(s);
|
av_freep(s);
|
||||||
|
@@ -76,12 +76,12 @@ static int crypto_open(URLContext *h, const char *uri, int flags)
|
|||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (flags & AVIO_FLAG_WRITE) {
|
if (flags == AVIO_WRONLY) {
|
||||||
av_log(h, AV_LOG_ERROR, "Only decryption is supported currently\n");
|
av_log(h, AV_LOG_ERROR, "Only decryption is supported currently\n");
|
||||||
ret = AVERROR(ENOSYS);
|
ret = AVERROR(ENOSYS);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if ((ret = ffurl_open(&c->hd, nested_url, AVIO_FLAG_READ)) < 0) {
|
if ((ret = ffurl_open(&c->hd, nested_url, AVIO_RDONLY)) < 0) {
|
||||||
av_log(h, AV_LOG_ERROR, "Unable to open input\n");
|
av_log(h, AV_LOG_ERROR, "Unable to open input\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@@ -58,8 +58,9 @@ static int file_check(URLContext *h, int mask)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return AVERROR(errno);
|
return AVERROR(errno);
|
||||||
|
|
||||||
ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0;
|
ret |= st.st_mode&S_IRUSR ? mask&AVIO_RDONLY : 0;
|
||||||
ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
|
ret |= st.st_mode&S_IWUSR ? mask&AVIO_WRONLY : 0;
|
||||||
|
ret |= st.st_mode&S_IWUSR && st.st_mode&S_IRUSR ? mask&AVIO_RDWR : 0;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -73,9 +74,9 @@ static int file_open(URLContext *h, const char *filename, int flags)
|
|||||||
|
|
||||||
av_strstart(filename, "file:", &filename);
|
av_strstart(filename, "file:", &filename);
|
||||||
|
|
||||||
if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) {
|
if (flags & AVIO_RDWR) {
|
||||||
access = O_CREAT | O_TRUNC | O_RDWR;
|
access = O_CREAT | O_TRUNC | O_RDWR;
|
||||||
} else if (flags & AVIO_FLAG_WRITE) {
|
} else if (flags & AVIO_WRONLY) {
|
||||||
access = O_CREAT | O_TRUNC | O_WRONLY;
|
access = O_CREAT | O_TRUNC | O_WRONLY;
|
||||||
} else {
|
} else {
|
||||||
access = O_RDONLY;
|
access = O_RDONLY;
|
||||||
@@ -131,7 +132,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
|
|||||||
|
|
||||||
fd = strtol(filename, &final, 10);
|
fd = strtol(filename, &final, 10);
|
||||||
if((filename == final) || *final ) {/* No digits found, or something like 10ab */
|
if((filename == final) || *final ) {/* No digits found, or something like 10ab */
|
||||||
if (flags & AVIO_FLAG_WRITE) {
|
if (flags & AVIO_WRONLY) {
|
||||||
fd = 1;
|
fd = 1;
|
||||||
} else {
|
} else {
|
||||||
fd = 0;
|
fd = 0;
|
||||||
|
@@ -50,7 +50,7 @@ static int gopher_connect(URLContext *h, const char *path)
|
|||||||
if (!path) return AVERROR(EINVAL);
|
if (!path) return AVERROR(EINVAL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(h, AV_LOG_WARNING,
|
av_log(NULL, AV_LOG_WARNING,
|
||||||
"Gopher protocol type '%c' not supported yet!\n",
|
"Gopher protocol type '%c' not supported yet!\n",
|
||||||
*path);
|
*path);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
@@ -100,7 +100,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
|
|||||||
ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
|
ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
|
||||||
|
|
||||||
s->hd = NULL;
|
s->hd = NULL;
|
||||||
err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE);
|
err = ffurl_open(&s->hd, buf, AVIO_RDWR);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@@ -73,7 +73,7 @@ void ff_http_set_headers(URLContext *h, const char *headers)
|
|||||||
int len = strlen(headers);
|
int len = strlen(headers);
|
||||||
|
|
||||||
if (len && strcmp("\r\n", headers + len - 2))
|
if (len && strcmp("\r\n", headers + len - 2))
|
||||||
av_log(h, AV_LOG_ERROR, "No trailing CRLF found in HTTP header.\n");
|
av_log(NULL, AV_LOG_ERROR, "No trailing CRLF found in HTTP header.\n");
|
||||||
|
|
||||||
av_strlcpy(s->headers, headers, sizeof(s->headers));
|
av_strlcpy(s->headers, headers, sizeof(s->headers));
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ static int http_open_cnx(URLContext *h)
|
|||||||
port = 80;
|
port = 80;
|
||||||
|
|
||||||
ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
|
ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
|
||||||
err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE);
|
err = ffurl_open(&hd, buf, AVIO_RDWR);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ static int process_line(URLContext *h, char *line, int line_count,
|
|||||||
* don't abort until all headers have been parsed. */
|
* don't abort until all headers have been parsed. */
|
||||||
if (s->http_code >= 400 && s->http_code < 600 && s->http_code != 401) {
|
if (s->http_code >= 400 && s->http_code < 600 && s->http_code != 401) {
|
||||||
end += strspn(end, SPACE_CHARS);
|
end += strspn(end, SPACE_CHARS);
|
||||||
av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n",
|
av_log(NULL, AV_LOG_WARNING, "HTTP error %d %s\n",
|
||||||
s->http_code, end);
|
s->http_code, end);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
|
|||||||
|
|
||||||
|
|
||||||
/* send http header */
|
/* send http header */
|
||||||
post = h->flags & AVIO_FLAG_WRITE;
|
post = h->flags & AVIO_WRONLY;
|
||||||
authstr = ff_http_auth_create_response(&s->auth_state, auth, path,
|
authstr = ff_http_auth_create_response(&s->auth_state, auth, path,
|
||||||
post ? "POST" : "GET");
|
post ? "POST" : "GET");
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ static int http_close(URLContext *h)
|
|||||||
HTTPContext *s = h->priv_data;
|
HTTPContext *s = h->priv_data;
|
||||||
|
|
||||||
/* signal end of chunked encoding if used */
|
/* signal end of chunked encoding if used */
|
||||||
if ((h->flags & AVIO_FLAG_WRITE) && s->chunksize != -1) {
|
if ((h->flags & AVIO_WRONLY) && s->chunksize != -1) {
|
||||||
ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
|
ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
|
||||||
ret = ret > 0 ? 0 : ret;
|
ret = ret > 0 ? 0 : ret;
|
||||||
}
|
}
|
||||||
|
@@ -86,6 +86,8 @@ typedef struct IdcinDemuxContext {
|
|||||||
int audio_present;
|
int audio_present;
|
||||||
|
|
||||||
int64_t pts;
|
int64_t pts;
|
||||||
|
|
||||||
|
AVPaletteControl palctrl;
|
||||||
} IdcinDemuxContext;
|
} IdcinDemuxContext;
|
||||||
|
|
||||||
static int idcin_probe(AVProbeData *p)
|
static int idcin_probe(AVProbeData *p)
|
||||||
@@ -170,6 +172,8 @@ static int idcin_read_header(AVFormatContext *s,
|
|||||||
if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
|
if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
|
||||||
HUFFMAN_TABLE_SIZE)
|
HUFFMAN_TABLE_SIZE)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
|
/* save a reference in order to transport the palette */
|
||||||
|
st->codec->palctrl = &idcin->palctrl;
|
||||||
|
|
||||||
/* if sample rate is 0, assume no audio */
|
/* if sample rate is 0, assume no audio */
|
||||||
if (sample_rate) {
|
if (sample_rate) {
|
||||||
@@ -222,7 +226,6 @@ static int idcin_read_packet(AVFormatContext *s,
|
|||||||
int palette_scale;
|
int palette_scale;
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
unsigned char palette_buffer[768];
|
unsigned char palette_buffer[768];
|
||||||
uint32_t palette[256];
|
|
||||||
|
|
||||||
if (url_feof(s->pb))
|
if (url_feof(s->pb))
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
@@ -233,6 +236,7 @@ static int idcin_read_packet(AVFormatContext *s,
|
|||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
} else if (command == 1) {
|
} else if (command == 1) {
|
||||||
/* trigger a palette change */
|
/* trigger a palette change */
|
||||||
|
idcin->palctrl.palette_changed = 1;
|
||||||
if (avio_read(pb, palette_buffer, 768) != 768)
|
if (avio_read(pb, palette_buffer, 768) != 768)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
/* scale the palette as necessary */
|
/* scale the palette as necessary */
|
||||||
@@ -247,7 +251,7 @@ static int idcin_read_packet(AVFormatContext *s,
|
|||||||
r = palette_buffer[i * 3 ] << palette_scale;
|
r = palette_buffer[i * 3 ] << palette_scale;
|
||||||
g = palette_buffer[i * 3 + 1] << palette_scale;
|
g = palette_buffer[i * 3 + 1] << palette_scale;
|
||||||
b = palette_buffer[i * 3 + 2] << palette_scale;
|
b = palette_buffer[i * 3 + 2] << palette_scale;
|
||||||
palette[i] = (r << 16) | (g << 8) | (b);
|
idcin->palctrl.palette[i] = (r << 16) | (g << 8) | (b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,15 +262,6 @@ static int idcin_read_packet(AVFormatContext *s,
|
|||||||
ret= av_get_packet(pb, pkt, chunk_size);
|
ret= av_get_packet(pb, pkt, chunk_size);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (command == 1) {
|
|
||||||
uint8_t *pal;
|
|
||||||
|
|
||||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
|
|
||||||
AVPALETTE_SIZE);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
memcpy(pal, palette, AVPALETTE_SIZE);
|
|
||||||
}
|
|
||||||
pkt->stream_index = idcin->video_stream_index;
|
pkt->stream_index = idcin->video_stream_index;
|
||||||
pkt->pts = idcin->pts;
|
pkt->pts = idcin->pts;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -143,11 +143,11 @@ static int find_image_range(int *pfirst_index, int *plast_index,
|
|||||||
if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
|
if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
|
||||||
*pfirst_index =
|
*pfirst_index =
|
||||||
*plast_index = 1;
|
*plast_index = 1;
|
||||||
if (avio_check(buf, AVIO_FLAG_READ) > 0)
|
if(url_exist(buf))
|
||||||
return 0;
|
return 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (avio_check(buf, AVIO_FLAG_READ) > 0)
|
if (url_exist(buf))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (first_index == 5)
|
if (first_index == 5)
|
||||||
@@ -165,7 +165,7 @@ static int find_image_range(int *pfirst_index, int *plast_index,
|
|||||||
if (av_get_frame_filename(buf, sizeof(buf), path,
|
if (av_get_frame_filename(buf, sizeof(buf), path,
|
||||||
last_index + range1) < 0)
|
last_index + range1) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (avio_check(buf, AVIO_FLAG_READ) <= 0)
|
if (!url_exist(buf))
|
||||||
break;
|
break;
|
||||||
range = range1;
|
range = range1;
|
||||||
/* just in case... */
|
/* just in case... */
|
||||||
@@ -314,7 +314,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
|
|||||||
s->path, s->img_number)<0 && s->img_number > 1)
|
s->path, s->img_number)<0 && s->img_number > 1)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
for(i=0; i<3; i++){
|
for(i=0; i<3; i++){
|
||||||
if (avio_open(&f[i], filename, AVIO_FLAG_READ) < 0) {
|
if (avio_open(&f[i], filename, AVIO_RDONLY) < 0) {
|
||||||
if(i==1)
|
if(i==1)
|
||||||
break;
|
break;
|
||||||
av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
|
av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
|
||||||
@@ -401,7 +401,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
for(i=0; i<3; i++){
|
for(i=0; i<3; i++){
|
||||||
if (avio_open(&pb[i], filename, AVIO_FLAG_WRITE) < 0) {
|
if (avio_open(&pb[i], filename, AVIO_WRONLY) < 0) {
|
||||||
av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename);
|
av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename);
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,18 @@ void ff_read_frame_flush(AVFormatContext *s);
|
|||||||
/** Get the current time since NTP epoch in microseconds. */
|
/** Get the current time since NTP epoch in microseconds. */
|
||||||
uint64_t ff_ntp_time(void);
|
uint64_t ff_ntp_time(void);
|
||||||
|
|
||||||
|
#if FF_API_URL_SPLIT
|
||||||
|
/**
|
||||||
|
* @deprecated use av_url_split() instead
|
||||||
|
*/
|
||||||
|
void ff_url_split(char *proto, int proto_size,
|
||||||
|
char *authorization, int authorization_size,
|
||||||
|
char *hostname, int hostname_size,
|
||||||
|
int *port_ptr,
|
||||||
|
char *path, int path_size,
|
||||||
|
const char *url);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assemble a URL string from components. This is the reverse operation
|
* Assemble a URL string from components. This is the reverse operation
|
||||||
* of av_url_split.
|
* of av_url_split.
|
||||||
|
@@ -86,8 +86,6 @@ typedef struct IPMVEContext {
|
|||||||
unsigned int video_width;
|
unsigned int video_width;
|
||||||
unsigned int video_height;
|
unsigned int video_height;
|
||||||
int64_t video_pts;
|
int64_t video_pts;
|
||||||
uint32_t palette[256];
|
|
||||||
int has_palette;
|
|
||||||
|
|
||||||
unsigned int audio_bits;
|
unsigned int audio_bits;
|
||||||
unsigned int audio_channels;
|
unsigned int audio_channels;
|
||||||
@@ -107,6 +105,8 @@ typedef struct IPMVEContext {
|
|||||||
|
|
||||||
int64_t next_chunk_offset;
|
int64_t next_chunk_offset;
|
||||||
|
|
||||||
|
AVPaletteControl palette_control;
|
||||||
|
|
||||||
} IPMVEContext;
|
} IPMVEContext;
|
||||||
|
|
||||||
static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
|
static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
|
||||||
@@ -151,17 +151,6 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
|
|||||||
if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size))
|
if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size))
|
||||||
return CHUNK_NOMEM;
|
return CHUNK_NOMEM;
|
||||||
|
|
||||||
if (s->has_palette) {
|
|
||||||
uint8_t *pal;
|
|
||||||
|
|
||||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
|
|
||||||
AVPALETTE_SIZE);
|
|
||||||
if (pal) {
|
|
||||||
memcpy(pal, s->palette, AVPALETTE_SIZE);
|
|
||||||
s->has_palette = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pkt->pos= s->decode_map_chunk_offset;
|
pkt->pos= s->decode_map_chunk_offset;
|
||||||
avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET);
|
avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET);
|
||||||
s->decode_map_chunk_offset = 0;
|
s->decode_map_chunk_offset = 0;
|
||||||
@@ -455,9 +444,10 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
|
|||||||
r = scratch[j++] * 4;
|
r = scratch[j++] * 4;
|
||||||
g = scratch[j++] * 4;
|
g = scratch[j++] * 4;
|
||||||
b = scratch[j++] * 4;
|
b = scratch[j++] * 4;
|
||||||
s->palette[i] = (r << 16) | (g << 8) | (b);
|
s->palette_control.palette[i] = (r << 16) | (g << 8) | (b);
|
||||||
}
|
}
|
||||||
s->has_palette = 1;
|
/* indicate a palette change */
|
||||||
|
s->palette_control.palette_changed = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_SET_PALETTE_COMPRESSED:
|
case OPCODE_SET_PALETTE_COMPRESSED:
|
||||||
@@ -571,6 +561,9 @@ static int ipmovie_read_header(AVFormatContext *s,
|
|||||||
st->codec->height = ipmovie->video_height;
|
st->codec->height = ipmovie->video_height;
|
||||||
st->codec->bits_per_coded_sample = ipmovie->video_bpp;
|
st->codec->bits_per_coded_sample = ipmovie->video_bpp;
|
||||||
|
|
||||||
|
/* palette considerations */
|
||||||
|
st->codec->palctrl = &ipmovie->palette_control;
|
||||||
|
|
||||||
if (ipmovie->audio_type) {
|
if (ipmovie->audio_type) {
|
||||||
st = av_new_stream(s, 0);
|
st = av_new_stream(s, 0);
|
||||||
if (!st)
|
if (!st)
|
||||||
|
@@ -123,8 +123,6 @@ typedef struct MOVStreamContext {
|
|||||||
int width; ///< tkhd width
|
int width; ///< tkhd width
|
||||||
int height; ///< tkhd height
|
int height; ///< tkhd height
|
||||||
int dts_shift; ///< dts shift when ctts is negative
|
int dts_shift; ///< dts shift when ctts is negative
|
||||||
uint32_t palette[256];
|
|
||||||
int has_palette;
|
|
||||||
} MOVStreamContext;
|
} MOVStreamContext;
|
||||||
|
|
||||||
typedef struct MOVContext {
|
typedef struct MOVContext {
|
||||||
|
@@ -94,7 +94,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & AVIO_FLAG_WRITE)
|
if (flags & AVIO_WRONLY)
|
||||||
RTMP_EnableWrite(r);
|
RTMP_EnableWrite(r);
|
||||||
|
|
||||||
if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
|
if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
|
||||||
|
@@ -1372,7 +1372,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
&& track->codec_priv.data != NULL) {
|
&& track->codec_priv.data != NULL) {
|
||||||
int ret;
|
int ret;
|
||||||
ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size,
|
ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size,
|
||||||
AVIO_FLAG_READ, NULL, NULL, NULL, NULL);
|
AVIO_RDONLY, NULL, NULL, NULL, NULL);
|
||||||
ret = ff_get_wav_header(&b, st->codec, track->codec_priv.size);
|
ret = ff_get_wav_header(&b, st->codec, track->codec_priv.size);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -36,7 +36,7 @@ static int md5_open(URLContext *h, const char *filename, int flags)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flags & AVIO_FLAG_WRITE)
|
if (flags != AVIO_WRONLY)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
av_md5_init(h->priv_data);
|
av_md5_init(h->priv_data);
|
||||||
@@ -65,7 +65,7 @@ static int md5_close(URLContext *h)
|
|||||||
av_strstart(filename, "md5:", &filename);
|
av_strstart(filename, "md5:", &filename);
|
||||||
|
|
||||||
if (*filename) {
|
if (*filename) {
|
||||||
err = ffurl_open(&out, filename, AVIO_FLAG_WRITE);
|
err = ffurl_open(&out, filename, AVIO_WRONLY);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
err = ffurl_write(out, buf, i*2+1);
|
err = ffurl_write(out, buf, i*2+1);
|
||||||
|
@@ -34,6 +34,15 @@ int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int
|
|||||||
{
|
{
|
||||||
return av_dict_set(pm, key, value, flags);
|
return av_dict_set(pm, key, value, flags);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
int av_metadata_set(AVMetadata **pm, const char *key, const char *value)
|
||||||
|
{
|
||||||
|
return av_metadata_set2(pm, key, value, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FF_API_OLD_METADATA2
|
||||||
|
|
||||||
void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv,
|
void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv,
|
||||||
const AVMetadataConv *s_conv)
|
const AVMetadataConv *s_conv)
|
||||||
|
@@ -39,6 +39,11 @@ struct AVMetadataConv{
|
|||||||
typedef struct AVMetadataConv AVMetadataConv;
|
typedef struct AVMetadataConv AVMetadataConv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
void ff_metadata_demux_compat(AVFormatContext *s);
|
||||||
|
void ff_metadata_mux_compat(AVFormatContext *s);
|
||||||
|
#endif
|
||||||
|
|
||||||
void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv,
|
void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv,
|
||||||
const AVMetadataConv *s_conv);
|
const AVMetadataConv *s_conv);
|
||||||
void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv,
|
void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv,
|
||||||
|
148
libavformat/metadata_compat.c
Normal file
148
libavformat/metadata_compat.c
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 Aurelien Jacobs <aurel@gnuage.org>
|
||||||
|
*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <strings.h>
|
||||||
|
#include "avformat.h"
|
||||||
|
#include "metadata.h"
|
||||||
|
#include "libavutil/avstring.h"
|
||||||
|
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
|
||||||
|
#define SIZE_OFFSET(x) sizeof(((AVFormatContext*)0)->x),offsetof(AVFormatContext,x)
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
const char name[16];
|
||||||
|
int size;
|
||||||
|
int offset;
|
||||||
|
} compat_tab[] = {
|
||||||
|
{ "title", SIZE_OFFSET(title) },
|
||||||
|
{ "author", SIZE_OFFSET(author) },
|
||||||
|
{ "copyright", SIZE_OFFSET(copyright) },
|
||||||
|
{ "comment", SIZE_OFFSET(comment) },
|
||||||
|
{ "album", SIZE_OFFSET(album) },
|
||||||
|
{ "year", SIZE_OFFSET(year) },
|
||||||
|
{ "track", SIZE_OFFSET(track) },
|
||||||
|
{ "genre", SIZE_OFFSET(genre) },
|
||||||
|
|
||||||
|
{ "artist", SIZE_OFFSET(author) },
|
||||||
|
{ "creator", SIZE_OFFSET(author) },
|
||||||
|
{ "written_by", SIZE_OFFSET(author) },
|
||||||
|
{ "lead_performer", SIZE_OFFSET(author) },
|
||||||
|
{ "composer", SIZE_OFFSET(author) },
|
||||||
|
{ "performer", SIZE_OFFSET(author) },
|
||||||
|
{ "description", SIZE_OFFSET(comment) },
|
||||||
|
{ "albumtitle", SIZE_OFFSET(album) },
|
||||||
|
{ "date", SIZE_OFFSET(year) },
|
||||||
|
{ "date_written", SIZE_OFFSET(year) },
|
||||||
|
{ "date_released", SIZE_OFFSET(year) },
|
||||||
|
{ "tracknumber", SIZE_OFFSET(track) },
|
||||||
|
{ "part_number", SIZE_OFFSET(track) },
|
||||||
|
};
|
||||||
|
|
||||||
|
void ff_metadata_demux_compat(AVFormatContext *ctx)
|
||||||
|
{
|
||||||
|
AVMetadata *m;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
if ((m = ctx->metadata))
|
||||||
|
for (j=0; j<m->count; j++)
|
||||||
|
for (i=0; i<FF_ARRAY_ELEMS(compat_tab); i++)
|
||||||
|
if (!strcasecmp(m->elems[j].key, compat_tab[i].name)) {
|
||||||
|
int *ptr = (int *)((char *)ctx+compat_tab[i].offset);
|
||||||
|
if (*ptr) continue;
|
||||||
|
if (compat_tab[i].size > sizeof(int))
|
||||||
|
av_strlcpy((char *)ptr, m->elems[j].value, compat_tab[i].size);
|
||||||
|
else
|
||||||
|
*ptr = atoi(m->elems[j].value);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<ctx->nb_chapters; i++)
|
||||||
|
if ((m = ctx->chapters[i]->metadata))
|
||||||
|
for (j=0; j<m->count; j++)
|
||||||
|
if (!strcasecmp(m->elems[j].key, "title")) {
|
||||||
|
av_free(ctx->chapters[i]->title);
|
||||||
|
ctx->chapters[i]->title = av_strdup(m->elems[j].value);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<ctx->nb_programs; i++)
|
||||||
|
if ((m = ctx->programs[i]->metadata))
|
||||||
|
for (j=0; j<m->count; j++) {
|
||||||
|
if (!strcasecmp(m->elems[j].key, "name")) {
|
||||||
|
av_free(ctx->programs[i]->name);
|
||||||
|
ctx->programs[i]->name = av_strdup(m->elems[j].value);
|
||||||
|
}
|
||||||
|
if (!strcasecmp(m->elems[j].key, "provider_name")) {
|
||||||
|
av_free(ctx->programs[i]->provider_name);
|
||||||
|
ctx->programs[i]->provider_name = av_strdup(m->elems[j].value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<ctx->nb_streams; i++)
|
||||||
|
if ((m = ctx->streams[i]->metadata))
|
||||||
|
for (j=0; j<m->count; j++) {
|
||||||
|
if (!strcasecmp(m->elems[j].key, "language"))
|
||||||
|
av_strlcpy(ctx->streams[i]->language, m->elems[j].value, 4);
|
||||||
|
if (!strcasecmp(m->elems[j].key, "filename")) {
|
||||||
|
av_free(ctx->streams[i]->filename);
|
||||||
|
ctx->streams[i]->filename= av_strdup(m->elems[j].value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define FILL_METADATA(s, key, value) { \
|
||||||
|
if (!av_metadata_get(s->metadata, #key, NULL, 0)) \
|
||||||
|
av_metadata_set2(&s->metadata, #key, value, 0); \
|
||||||
|
}
|
||||||
|
#define FILL_METADATA_STR(s, key) { \
|
||||||
|
if (s->key && *s->key) FILL_METADATA(s, key, s->key); }
|
||||||
|
#define FILL_METADATA_INT(s, key) { \
|
||||||
|
char number[10]; \
|
||||||
|
snprintf(number, sizeof(number), "%d", s->key); \
|
||||||
|
if(s->key) FILL_METADATA(s, key, number) }
|
||||||
|
|
||||||
|
void ff_metadata_mux_compat(AVFormatContext *ctx)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (ctx->metadata && ctx->metadata->count > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
FILL_METADATA_STR(ctx, title);
|
||||||
|
FILL_METADATA_STR(ctx, author);
|
||||||
|
FILL_METADATA_STR(ctx, copyright);
|
||||||
|
FILL_METADATA_STR(ctx, comment);
|
||||||
|
FILL_METADATA_STR(ctx, album);
|
||||||
|
FILL_METADATA_INT(ctx, year);
|
||||||
|
FILL_METADATA_INT(ctx, track);
|
||||||
|
FILL_METADATA_STR(ctx, genre);
|
||||||
|
for (i=0; i<ctx->nb_chapters; i++)
|
||||||
|
FILL_METADATA_STR(ctx->chapters[i], title);
|
||||||
|
for (i=0; i<ctx->nb_programs; i++) {
|
||||||
|
FILL_METADATA_STR(ctx->programs[i], name);
|
||||||
|
FILL_METADATA_STR(ctx->programs[i], provider_name);
|
||||||
|
}
|
||||||
|
for (i=0; i<ctx->nb_streams; i++) {
|
||||||
|
FILL_METADATA_STR(ctx->streams[i], language);
|
||||||
|
FILL_METADATA_STR(ctx->streams[i], filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FF_API_OLD_METADATA */
|
@@ -24,7 +24,11 @@
|
|||||||
#include "asf.h"
|
#include "asf.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
|
|
||||||
|
#if FF_API_MAX_STREAMS
|
||||||
|
#define MMS_MAX_STREAMS MAX_STREAMS
|
||||||
|
#else
|
||||||
#define MMS_MAX_STREAMS 256 /**< arbitrary sanity check value */
|
#define MMS_MAX_STREAMS 256 /**< arbitrary sanity check value */
|
||||||
|
#endif
|
||||||
|
|
||||||
int ff_mms_read_header(MMSContext *mms, uint8_t *buf, const int size)
|
int ff_mms_read_header(MMSContext *mms, uint8_t *buf, const int size)
|
||||||
{
|
{
|
||||||
|
@@ -233,7 +233,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
|
|||||||
port = 80; // default mmsh protocol port
|
port = 80; // default mmsh protocol port
|
||||||
ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, "%s", path);
|
ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, "%s", path);
|
||||||
|
|
||||||
if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ) < 0) {
|
if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_RDONLY) < 0) {
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
|
|||||||
// close the socket and then reopen it for sending the second play request.
|
// close the socket and then reopen it for sending the second play request.
|
||||||
ffurl_close(mms->mms_hd);
|
ffurl_close(mms->mms_hd);
|
||||||
memset(headers, 0, sizeof(headers));
|
memset(headers, 0, sizeof(headers));
|
||||||
if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ) < 0) {
|
if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_RDONLY) < 0) {
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
stream_selection = av_mallocz(mms->stream_num * 19 + 1);
|
stream_selection = av_mallocz(mms->stream_num * 19 + 1);
|
||||||
|
@@ -523,7 +523,7 @@ static int mms_open(URLContext *h, const char *uri, int flags)
|
|||||||
|
|
||||||
// establish tcp connection.
|
// establish tcp connection.
|
||||||
ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, mmst->host, port, NULL);
|
ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, mmst->host, port, NULL);
|
||||||
err = ffurl_open(&mms->mms_hd, tcpname, AVIO_FLAG_READ_WRITE);
|
err = ffurl_open(&mms->mms_hd, tcpname, AVIO_RDWR);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@@ -1043,6 +1043,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
|||||||
unsigned int color_start, color_count, color_end;
|
unsigned int color_start, color_count, color_end;
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
|
|
||||||
|
st->codec->palctrl = av_malloc(sizeof(*st->codec->palctrl));
|
||||||
if (color_greyscale) {
|
if (color_greyscale) {
|
||||||
int color_index, color_dec;
|
int color_index, color_dec;
|
||||||
/* compute the greyscale palette */
|
/* compute the greyscale palette */
|
||||||
@@ -1052,7 +1053,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
|||||||
color_dec = 256 / (color_count - 1);
|
color_dec = 256 / (color_count - 1);
|
||||||
for (j = 0; j < color_count; j++) {
|
for (j = 0; j < color_count; j++) {
|
||||||
r = g = b = color_index;
|
r = g = b = color_index;
|
||||||
sc->palette[j] =
|
st->codec->palctrl->palette[j] =
|
||||||
(r << 16) | (g << 8) | (b);
|
(r << 16) | (g << 8) | (b);
|
||||||
color_index -= color_dec;
|
color_index -= color_dec;
|
||||||
if (color_index < 0)
|
if (color_index < 0)
|
||||||
@@ -1073,7 +1074,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
|||||||
r = color_table[j * 3 + 0];
|
r = color_table[j * 3 + 0];
|
||||||
g = color_table[j * 3 + 1];
|
g = color_table[j * 3 + 1];
|
||||||
b = color_table[j * 3 + 2];
|
b = color_table[j * 3 + 2];
|
||||||
sc->palette[j] =
|
st->codec->palctrl->palette[j] =
|
||||||
(r << 16) | (g << 8) | (b);
|
(r << 16) | (g << 8) | (b);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1095,12 +1096,12 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
|||||||
avio_r8(pb);
|
avio_r8(pb);
|
||||||
b = avio_r8(pb);
|
b = avio_r8(pb);
|
||||||
avio_r8(pb);
|
avio_r8(pb);
|
||||||
sc->palette[j] =
|
st->codec->palctrl->palette[j] =
|
||||||
(r << 16) | (g << 8) | (b);
|
(r << 16) | (g << 8) | (b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sc->has_palette = 1;
|
st->codec->palctrl->palette_changed = 1;
|
||||||
}
|
}
|
||||||
} else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
|
} else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
|
||||||
int bits_per_sample, flags;
|
int bits_per_sample, flags;
|
||||||
@@ -1738,7 +1739,7 @@ static int mov_open_dref(AVIOContext **pb, const char *src, MOVDref *ref)
|
|||||||
|
|
||||||
av_strlcat(filename, ref->path + l + 1, 1024);
|
av_strlcat(filename, ref->path + l + 1, 1024);
|
||||||
|
|
||||||
if (!avio_open(pb, filename, AVIO_FLAG_READ))
|
if (!avio_open(pb, filename, AVIO_RDONLY))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2481,17 +2482,6 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
ret = av_get_packet(sc->pb, pkt, sample->size);
|
ret = av_get_packet(sc->pb, pkt, sample->size);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (sc->has_palette) {
|
|
||||||
uint8_t *pal;
|
|
||||||
|
|
||||||
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
|
|
||||||
if (!pal) {
|
|
||||||
av_log(mov->fc, AV_LOG_ERROR, "Cannot append palette to packet\n");
|
|
||||||
} else {
|
|
||||||
memcpy(pal, sc->palette, AVPALETTE_SIZE);
|
|
||||||
sc->has_palette = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if CONFIG_DV_DEMUXER
|
#if CONFIG_DV_DEMUXER
|
||||||
if (mov->dv_demux && sc->dv_audio_container) {
|
if (mov->dv_demux && sc->dv_audio_container) {
|
||||||
dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos);
|
dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos);
|
||||||
|
@@ -700,6 +700,11 @@ static int mpegts_push_data(MpegTSFilter *filter,
|
|||||||
code == 0x1be) /* padding_stream */
|
code == 0x1be) /* padding_stream */
|
||||||
goto skip;
|
goto skip;
|
||||||
|
|
||||||
|
#if FF_API_MAX_STREAMS
|
||||||
|
if (!pes->st && pes->stream->nb_streams == MAX_STREAMS)
|
||||||
|
goto skip;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* stream not present in PMT */
|
/* stream not present in PMT */
|
||||||
if (!pes->st) {
|
if (!pes->st) {
|
||||||
pes->st = av_new_stream(ts->stream, pes->pid);
|
pes->st = av_new_stream(ts->stream, pes->pid);
|
||||||
|
@@ -31,7 +31,11 @@
|
|||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#if FF_API_MAX_STREAMS
|
||||||
|
#define NUT_MAX_STREAMS MAX_STREAMS
|
||||||
|
#else
|
||||||
#define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */
|
#define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */
|
||||||
|
#endif
|
||||||
|
|
||||||
static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){
|
static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){
|
||||||
unsigned int len= ffio_read_varlen(bc);
|
unsigned int len= ffio_read_varlen(bc);
|
||||||
|
@@ -71,7 +71,7 @@ typedef struct {
|
|||||||
|
|
||||||
static const AVOption options[] = {
|
static const AVOption options[] = {
|
||||||
{ "oggpagesize", "Set preferred Ogg page size.",
|
{ "oggpagesize", "Set preferred Ogg page size.",
|
||||||
offsetof(OGGContext, pref_size), FF_OPT_TYPE_INT, 0, 0, MAX_PAGE_SIZE, AV_OPT_FLAG_ENCODING_PARAM},
|
offsetof(OGGContext, pref_size), FF_OPT_TYPE_INT, {.dbl=0}, 0, MAX_PAGE_SIZE, AV_OPT_FLAG_ENCODING_PARAM},
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -122,3 +122,10 @@ AVFormatContext *avformat_alloc_context(void)
|
|||||||
avformat_get_context_defaults(ic);
|
avformat_get_context_defaults(ic);
|
||||||
return ic;
|
return ic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_ALLOC_FORMAT_CONTEXT
|
||||||
|
AVFormatContext *av_alloc_format_context(void)
|
||||||
|
{
|
||||||
|
return avformat_alloc_context();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -38,6 +38,13 @@
|
|||||||
#include "rtmppkt.h"
|
#include "rtmppkt.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
|
|
||||||
|
/* we can't use av_log() with URLContext yet... */
|
||||||
|
#if FF_API_URL_CLASS
|
||||||
|
#define LOG_CONTEXT s
|
||||||
|
#else
|
||||||
|
#define LOG_CONTEXT NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
/** RTMP protocol handler state */
|
/** RTMP protocol handler state */
|
||||||
@@ -159,7 +166,7 @@ static void gen_release_stream(URLContext *s, RTMPContext *rt)
|
|||||||
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
|
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
|
||||||
29 + strlen(rt->playpath));
|
29 + strlen(rt->playpath));
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "Releasing stream...\n");
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Releasing stream...\n");
|
||||||
p = pkt.data;
|
p = pkt.data;
|
||||||
ff_amf_write_string(&p, "releaseStream");
|
ff_amf_write_string(&p, "releaseStream");
|
||||||
ff_amf_write_number(&p, 2.0);
|
ff_amf_write_number(&p, 2.0);
|
||||||
@@ -182,7 +189,7 @@ static void gen_fcpublish_stream(URLContext *s, RTMPContext *rt)
|
|||||||
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
|
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
|
||||||
25 + strlen(rt->playpath));
|
25 + strlen(rt->playpath));
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "FCPublish stream...\n");
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "FCPublish stream...\n");
|
||||||
p = pkt.data;
|
p = pkt.data;
|
||||||
ff_amf_write_string(&p, "FCPublish");
|
ff_amf_write_string(&p, "FCPublish");
|
||||||
ff_amf_write_number(&p, 3.0);
|
ff_amf_write_number(&p, 3.0);
|
||||||
@@ -205,7 +212,7 @@ static void gen_fcunpublish_stream(URLContext *s, RTMPContext *rt)
|
|||||||
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
|
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
|
||||||
27 + strlen(rt->playpath));
|
27 + strlen(rt->playpath));
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "UnPublishing stream...\n");
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "UnPublishing stream...\n");
|
||||||
p = pkt.data;
|
p = pkt.data;
|
||||||
ff_amf_write_string(&p, "FCUnpublish");
|
ff_amf_write_string(&p, "FCUnpublish");
|
||||||
ff_amf_write_number(&p, 5.0);
|
ff_amf_write_number(&p, 5.0);
|
||||||
@@ -225,7 +232,7 @@ static void gen_create_stream(URLContext *s, RTMPContext *rt)
|
|||||||
RTMPPacket pkt;
|
RTMPPacket pkt;
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "Creating stream...\n");
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Creating stream...\n");
|
||||||
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 25);
|
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 25);
|
||||||
|
|
||||||
p = pkt.data;
|
p = pkt.data;
|
||||||
@@ -247,7 +254,7 @@ static void gen_delete_stream(URLContext *s, RTMPContext *rt)
|
|||||||
RTMPPacket pkt;
|
RTMPPacket pkt;
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "Deleting stream...\n");
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Deleting stream...\n");
|
||||||
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 34);
|
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 34);
|
||||||
|
|
||||||
p = pkt.data;
|
p = pkt.data;
|
||||||
@@ -269,7 +276,7 @@ static void gen_play(URLContext *s, RTMPContext *rt)
|
|||||||
RTMPPacket pkt;
|
RTMPPacket pkt;
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath);
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath);
|
||||||
ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0,
|
ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0,
|
||||||
20 + strlen(rt->playpath));
|
20 + strlen(rt->playpath));
|
||||||
pkt.extra = rt->main_channel_id;
|
pkt.extra = rt->main_channel_id;
|
||||||
@@ -303,7 +310,7 @@ static void gen_publish(URLContext *s, RTMPContext *rt)
|
|||||||
RTMPPacket pkt;
|
RTMPPacket pkt;
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "Sending publish command for '%s'\n", rt->playpath);
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending publish command for '%s'\n", rt->playpath);
|
||||||
ff_rtmp_packet_create(&pkt, RTMP_SOURCE_CHANNEL, RTMP_PT_INVOKE, 0,
|
ff_rtmp_packet_create(&pkt, RTMP_SOURCE_CHANNEL, RTMP_PT_INVOKE, 0,
|
||||||
30 + strlen(rt->playpath));
|
30 + strlen(rt->playpath));
|
||||||
pkt.extra = rt->main_channel_id;
|
pkt.extra = rt->main_channel_id;
|
||||||
@@ -471,7 +478,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
|
|||||||
int server_pos, client_pos;
|
int server_pos, client_pos;
|
||||||
uint8_t digest[32];
|
uint8_t digest[32];
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "Handshaking...\n");
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Handshaking...\n");
|
||||||
|
|
||||||
av_lfg_init(&rnd, 0xDEADC0DE);
|
av_lfg_init(&rnd, 0xDEADC0DE);
|
||||||
// generate handshake packet - 1536 bytes of pseudorandom data
|
// generate handshake packet - 1536 bytes of pseudorandom data
|
||||||
@@ -482,16 +489,16 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
|
|||||||
ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1);
|
ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1);
|
||||||
i = ffurl_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1);
|
i = ffurl_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1);
|
||||||
if (i != RTMP_HANDSHAKE_PACKET_SIZE + 1) {
|
if (i != RTMP_HANDSHAKE_PACKET_SIZE + 1) {
|
||||||
av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
|
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
i = ffurl_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE);
|
i = ffurl_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE);
|
||||||
if (i != RTMP_HANDSHAKE_PACKET_SIZE) {
|
if (i != RTMP_HANDSHAKE_PACKET_SIZE) {
|
||||||
av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
|
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "Server version %d.%d.%d.%d\n",
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Server version %d.%d.%d.%d\n",
|
||||||
serverdata[5], serverdata[6], serverdata[7], serverdata[8]);
|
serverdata[5], serverdata[6], serverdata[7], serverdata[8]);
|
||||||
|
|
||||||
if (rt->is_input && serverdata[5] >= 3) {
|
if (rt->is_input && serverdata[5] >= 3) {
|
||||||
@@ -499,7 +506,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
|
|||||||
if (!server_pos) {
|
if (!server_pos) {
|
||||||
server_pos = rtmp_validate_digest(serverdata + 1, 8);
|
server_pos = rtmp_validate_digest(serverdata + 1, 8);
|
||||||
if (!server_pos) {
|
if (!server_pos) {
|
||||||
av_log(s, AV_LOG_ERROR, "Server response validating failed\n");
|
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server response validating failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -511,7 +518,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
|
|||||||
digest, 32,
|
digest, 32,
|
||||||
digest);
|
digest);
|
||||||
if (memcmp(digest, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) {
|
if (memcmp(digest, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) {
|
||||||
av_log(s, AV_LOG_ERROR, "Signature mismatch\n");
|
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Signature mismatch\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,13 +552,13 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
|
|||||||
const uint8_t *data_end = pkt->data + pkt->data_size;
|
const uint8_t *data_end = pkt->data + pkt->data_size;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
ff_rtmp_packet_dump(s, pkt);
|
ff_rtmp_packet_dump(LOG_CONTEXT, pkt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (pkt->type) {
|
switch (pkt->type) {
|
||||||
case RTMP_PT_CHUNK_SIZE:
|
case RTMP_PT_CHUNK_SIZE:
|
||||||
if (pkt->data_size != 4) {
|
if (pkt->data_size != 4) {
|
||||||
av_log(s, AV_LOG_ERROR,
|
av_log(LOG_CONTEXT, AV_LOG_ERROR,
|
||||||
"Chunk size change packet is not 4 bytes long (%d)\n", pkt->data_size);
|
"Chunk size change packet is not 4 bytes long (%d)\n", pkt->data_size);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -559,10 +566,10 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
|
|||||||
ff_rtmp_packet_write(rt->stream, pkt, rt->chunk_size, rt->prev_pkt[1]);
|
ff_rtmp_packet_write(rt->stream, pkt, rt->chunk_size, rt->prev_pkt[1]);
|
||||||
rt->chunk_size = AV_RB32(pkt->data);
|
rt->chunk_size = AV_RB32(pkt->data);
|
||||||
if (rt->chunk_size <= 0) {
|
if (rt->chunk_size <= 0) {
|
||||||
av_log(s, AV_LOG_ERROR, "Incorrect chunk size %d\n", rt->chunk_size);
|
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Incorrect chunk size %d\n", rt->chunk_size);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
av_log(s, AV_LOG_DEBUG, "New chunk size = %d\n", rt->chunk_size);
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "New chunk size = %d\n", rt->chunk_size);
|
||||||
break;
|
break;
|
||||||
case RTMP_PT_PING:
|
case RTMP_PT_PING:
|
||||||
t = AV_RB16(pkt->data);
|
t = AV_RB16(pkt->data);
|
||||||
@@ -571,12 +578,12 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
|
|||||||
break;
|
break;
|
||||||
case RTMP_PT_CLIENT_BW:
|
case RTMP_PT_CLIENT_BW:
|
||||||
if (pkt->data_size < 4) {
|
if (pkt->data_size < 4) {
|
||||||
av_log(s, AV_LOG_ERROR,
|
av_log(LOG_CONTEXT, AV_LOG_ERROR,
|
||||||
"Client bandwidth report packet is less than 4 bytes long (%d)\n",
|
"Client bandwidth report packet is less than 4 bytes long (%d)\n",
|
||||||
pkt->data_size);
|
pkt->data_size);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
av_log(s, AV_LOG_DEBUG, "Client bandwidth = %d\n", AV_RB32(pkt->data));
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Client bandwidth = %d\n", AV_RB32(pkt->data));
|
||||||
rt->client_report_size = AV_RB32(pkt->data) >> 1;
|
rt->client_report_size = AV_RB32(pkt->data) >> 1;
|
||||||
break;
|
break;
|
||||||
case RTMP_PT_INVOKE:
|
case RTMP_PT_INVOKE:
|
||||||
@@ -586,7 +593,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
|
|||||||
|
|
||||||
if (!ff_amf_get_field_value(pkt->data + 9, data_end,
|
if (!ff_amf_get_field_value(pkt->data + 9, data_end,
|
||||||
"description", tmpstr, sizeof(tmpstr)))
|
"description", tmpstr, sizeof(tmpstr)))
|
||||||
av_log(s, AV_LOG_ERROR, "Server error: %s\n",tmpstr);
|
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server error: %s\n",tmpstr);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!memcmp(pkt->data, "\002\000\007_result", 10)) {
|
} else if (!memcmp(pkt->data, "\002\000\007_result", 10)) {
|
||||||
switch (rt->state) {
|
switch (rt->state) {
|
||||||
@@ -617,7 +624,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
|
|||||||
case STATE_CONNECTING:
|
case STATE_CONNECTING:
|
||||||
//extract a number from the result
|
//extract a number from the result
|
||||||
if (pkt->data[10] || pkt->data[19] != 5 || pkt->data[20]) {
|
if (pkt->data[10] || pkt->data[19] != 5 || pkt->data[20]) {
|
||||||
av_log(s, AV_LOG_WARNING, "Unexpected reply on connect()\n");
|
av_log(LOG_CONTEXT, AV_LOG_WARNING, "Unexpected reply on connect()\n");
|
||||||
} else {
|
} else {
|
||||||
rt->main_channel_id = (int) av_int2dbl(AV_RB64(pkt->data + 21));
|
rt->main_channel_id = (int) av_int2dbl(AV_RB64(pkt->data + 21));
|
||||||
}
|
}
|
||||||
@@ -644,7 +651,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
|
|||||||
if (!t && !strcmp(tmpstr, "error")) {
|
if (!t && !strcmp(tmpstr, "error")) {
|
||||||
if (!ff_amf_get_field_value(ptr, data_end,
|
if (!ff_amf_get_field_value(ptr, data_end,
|
||||||
"description", tmpstr, sizeof(tmpstr)))
|
"description", tmpstr, sizeof(tmpstr)))
|
||||||
av_log(s, AV_LOG_ERROR, "Server error: %s\n",tmpstr);
|
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server error: %s\n",tmpstr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
t = ff_amf_get_field_value(ptr, data_end,
|
t = ff_amf_get_field_value(ptr, data_end,
|
||||||
@@ -694,7 +701,7 @@ static int get_packet(URLContext *s, int for_header)
|
|||||||
}
|
}
|
||||||
rt->bytes_read += ret;
|
rt->bytes_read += ret;
|
||||||
if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) {
|
if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) {
|
||||||
av_log(s, AV_LOG_DEBUG, "Sending bytes read report\n");
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending bytes read report\n");
|
||||||
gen_bytes_read(s, rt, rpkt.timestamp + 1);
|
gen_bytes_read(s, rt, rpkt.timestamp + 1);
|
||||||
rt->last_bytes_read = rt->bytes_read;
|
rt->last_bytes_read = rt->bytes_read;
|
||||||
}
|
}
|
||||||
@@ -805,7 +812,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
|
|||||||
if (!rt)
|
if (!rt)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
s->priv_data = rt;
|
s->priv_data = rt;
|
||||||
rt->is_input = !(flags & AVIO_FLAG_WRITE);
|
rt->is_input = !(flags & AVIO_WRONLY);
|
||||||
|
|
||||||
av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
|
av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
|
||||||
path, sizeof(path), s->filename);
|
path, sizeof(path), s->filename);
|
||||||
@@ -814,8 +821,8 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
|
|||||||
port = RTMP_DEFAULT_PORT;
|
port = RTMP_DEFAULT_PORT;
|
||||||
ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
|
ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
|
||||||
|
|
||||||
if (ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE) < 0) {
|
if (ffurl_open(&rt->stream, buf, AVIO_RDWR) < 0) {
|
||||||
av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf);
|
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot open connection %s\n", buf);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -859,7 +866,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
|
|||||||
rt->bytes_read = 0;
|
rt->bytes_read = 0;
|
||||||
rt->last_bytes_read = 0;
|
rt->last_bytes_read = 0;
|
||||||
|
|
||||||
av_log(s, AV_LOG_DEBUG, "Proto = %s, path = %s, app = %s, fname = %s\n",
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Proto = %s, path = %s, app = %s, fname = %s\n",
|
||||||
proto, path, rt->app, rt->playpath);
|
proto, path, rt->app, rt->playpath);
|
||||||
gen_connect(s, rt, proto, hostname, port);
|
gen_connect(s, rt, proto, hostname, port);
|
||||||
|
|
||||||
@@ -926,7 +933,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
|
|||||||
const uint8_t *buf_temp = buf;
|
const uint8_t *buf_temp = buf;
|
||||||
|
|
||||||
if (size < 11) {
|
if (size < 11) {
|
||||||
av_log(s, AV_LOG_DEBUG, "FLV packet too small %d\n", size);
|
av_log(LOG_CONTEXT, AV_LOG_DEBUG, "FLV packet too small %d\n", size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1118,14 +1118,14 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
|
|||||||
"?localport=%d", j);
|
"?localport=%d", j);
|
||||||
/* we will use two ports per rtp stream (rtp and rtcp) */
|
/* we will use two ports per rtp stream (rtp and rtcp) */
|
||||||
j += 2;
|
j += 2;
|
||||||
if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE) == 0)
|
if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_RDWR) == 0)
|
||||||
goto rtp_opened;
|
goto rtp_opened;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* then try on any port */
|
/* then try on any port */
|
||||||
if (ffurl_open(&rtsp_st->rtp_handle, "rtp://", AVIO_FLAG_READ) < 0) {
|
if (ffurl_open(&rtsp_st->rtp_handle, "rtp://", AVIO_RDONLY) < 0) {
|
||||||
err = AVERROR_INVALIDDATA;
|
err = AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1271,7 +1271,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
|
|||||||
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
|
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
|
||||||
ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
|
ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
|
||||||
port, "?ttl=%d", ttl);
|
port, "?ttl=%d", ttl);
|
||||||
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE) < 0) {
|
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_RDWR) < 0) {
|
||||||
err = AVERROR_INVALIDDATA;
|
err = AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1398,7 +1398,7 @@ redirect:
|
|||||||
av_get_random_seed(), av_get_random_seed());
|
av_get_random_seed(), av_get_random_seed());
|
||||||
|
|
||||||
/* GET requests */
|
/* GET requests */
|
||||||
if (ffurl_alloc(&rt->rtsp_hd, httpname, AVIO_FLAG_READ) < 0) {
|
if (ffurl_alloc(&rt->rtsp_hd, httpname, AVIO_RDONLY) < 0) {
|
||||||
err = AVERROR(EIO);
|
err = AVERROR(EIO);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1419,7 +1419,7 @@ redirect:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* POST requests */
|
/* POST requests */
|
||||||
if (ffurl_alloc(&rt->rtsp_hd_out, httpname, AVIO_FLAG_WRITE) < 0 ) {
|
if (ffurl_alloc(&rt->rtsp_hd_out, httpname, AVIO_WRONLY) < 0 ) {
|
||||||
err = AVERROR(EIO);
|
err = AVERROR(EIO);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1462,7 +1462,7 @@ redirect:
|
|||||||
} else {
|
} else {
|
||||||
/* open the tcp connection */
|
/* open the tcp connection */
|
||||||
ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
|
ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
|
||||||
if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE) < 0) {
|
if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_RDWR) < 0) {
|
||||||
err = AVERROR(EIO);
|
err = AVERROR(EIO);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1809,7 +1809,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
namebuf, rtsp_st->sdp_port,
|
namebuf, rtsp_st->sdp_port,
|
||||||
"?localport=%d&ttl=%d", rtsp_st->sdp_port,
|
"?localport=%d&ttl=%d", rtsp_st->sdp_port,
|
||||||
rtsp_st->sdp_ttl);
|
rtsp_st->sdp_ttl);
|
||||||
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE) < 0) {
|
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_RDWR) < 0) {
|
||||||
err = AVERROR_INVALIDDATA;
|
err = AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1865,7 +1865,7 @@ static int rtp_read_header(AVFormatContext *s,
|
|||||||
if (!ff_network_init())
|
if (!ff_network_init())
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
|
|
||||||
ret = ffurl_open(&in, s->filename, AVIO_FLAG_READ);
|
ret = ffurl_open(&in, s->filename, AVIO_RDONLY);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@@ -85,7 +85,7 @@ static int sap_read_header(AVFormatContext *s,
|
|||||||
|
|
||||||
ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d",
|
ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d",
|
||||||
port);
|
port);
|
||||||
ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_READ);
|
ret = ffurl_open(&sap->ann_fd, url, AVIO_RDONLY);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ static int sap_write_header(AVFormatContext *s)
|
|||||||
"?ttl=%d", ttl);
|
"?ttl=%d", ttl);
|
||||||
if (!same_port)
|
if (!same_port)
|
||||||
base_port += 2;
|
base_port += 2;
|
||||||
ret = ffurl_open(&fd, url, AVIO_FLAG_WRITE);
|
ret = ffurl_open(&fd, url, AVIO_WRONLY);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ret = AVERROR(EIO);
|
ret = AVERROR(EIO);
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -158,7 +158,7 @@ static int sap_write_header(AVFormatContext *s)
|
|||||||
|
|
||||||
ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
|
ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
|
||||||
"?ttl=%d&connect=1", ttl);
|
"?ttl=%d&connect=1", ttl);
|
||||||
ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_WRITE);
|
ret = ffurl_open(&sap->ann_fd, url, AVIO_WRONLY);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ret = AVERROR(EIO);
|
ret = AVERROR(EIO);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@@ -68,7 +68,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
|
|||||||
snprintf(portstr, sizeof(portstr), "%d", port);
|
snprintf(portstr, sizeof(portstr), "%d", port);
|
||||||
ret = getaddrinfo(hostname, portstr, &hints, &ai);
|
ret = getaddrinfo(hostname, portstr, &hints, &ai);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
av_log(h, AV_LOG_ERROR,
|
av_log(NULL, AV_LOG_ERROR,
|
||||||
"Failed to resolve hostname %s: %s\n",
|
"Failed to resolve hostname %s: %s\n",
|
||||||
hostname, gai_strerror(ret));
|
hostname, gai_strerror(ret));
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
@@ -128,7 +128,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
|
|||||||
optlen = sizeof(ret);
|
optlen = sizeof(ret);
|
||||||
getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
|
getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
av_log(h, AV_LOG_ERROR,
|
av_log(NULL, AV_LOG_ERROR,
|
||||||
"TCP connection to %s:%d failed: %s\n",
|
"TCP connection to %s:%d failed: %s\n",
|
||||||
hostname, port, strerror(ret));
|
hostname, port, strerror(ret));
|
||||||
ret = AVERROR(ret);
|
ret = AVERROR(ret);
|
||||||
|
@@ -280,7 +280,7 @@ int ff_udp_set_remote_url(URLContext *h, const char *uri)
|
|||||||
if (connect(s->udp_fd, (struct sockaddr *) &s->dest_addr,
|
if (connect(s->udp_fd, (struct sockaddr *) &s->dest_addr,
|
||||||
s->dest_addr_len)) {
|
s->dest_addr_len)) {
|
||||||
s->is_connected = 0;
|
s->is_connected = 0;
|
||||||
av_log(h, AV_LOG_ERROR, "connect: %s\n", strerror(errno));
|
av_log(NULL, AV_LOG_ERROR, "connect: %s\n", strerror(errno));
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,10 @@ int ff_udp_get_local_port(URLContext *h)
|
|||||||
* streams at the same time.
|
* streams at the same time.
|
||||||
* @param h media file context
|
* @param h media file context
|
||||||
*/
|
*/
|
||||||
static int udp_get_file_handle(URLContext *h)
|
#if !FF_API_UDP_GET_FILE
|
||||||
|
static
|
||||||
|
#endif
|
||||||
|
int udp_get_file_handle(URLContext *h)
|
||||||
{
|
{
|
||||||
UDPContext *s = h->priv_data;
|
UDPContext *s = h->priv_data;
|
||||||
return s->udp_fd;
|
return s->udp_fd;
|
||||||
@@ -389,7 +392,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
|
|||||||
h->is_streamed = 1;
|
h->is_streamed = 1;
|
||||||
h->max_packet_size = 1472;
|
h->max_packet_size = 1472;
|
||||||
|
|
||||||
is_output = !(flags & AVIO_FLAG_READ);
|
is_output = (flags & AVIO_WRONLY);
|
||||||
|
|
||||||
s = av_mallocz(sizeof(UDPContext));
|
s = av_mallocz(sizeof(UDPContext));
|
||||||
if (!s)
|
if (!s)
|
||||||
@@ -437,14 +440,14 @@ static int udp_open(URLContext *h, const char *uri, int flags)
|
|||||||
/* XXX: fix av_url_split */
|
/* XXX: fix av_url_split */
|
||||||
if (hostname[0] == '\0' || hostname[0] == '?') {
|
if (hostname[0] == '\0' || hostname[0] == '?') {
|
||||||
/* only accepts null hostname if input */
|
/* only accepts null hostname if input */
|
||||||
if (!(flags & AVIO_FLAG_READ))
|
if (flags & AVIO_WRONLY)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
if (ff_udp_set_remote_url(h, uri) < 0)
|
if (ff_udp_set_remote_url(h, uri) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
|
if (s->is_multicast && !(h->flags & AVIO_WRONLY))
|
||||||
s->local_port = port;
|
s->local_port = port;
|
||||||
udp_fd = udp_socket_create(s, &my_addr, &len);
|
udp_fd = udp_socket_create(s, &my_addr, &len);
|
||||||
if (udp_fd < 0)
|
if (udp_fd < 0)
|
||||||
@@ -461,7 +464,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
|
|||||||
|
|
||||||
/* the bind is needed to give a port to the socket now */
|
/* the bind is needed to give a port to the socket now */
|
||||||
/* if multicast, try the multicast address bind first */
|
/* if multicast, try the multicast address bind first */
|
||||||
if (s->is_multicast && (h->flags & AVIO_FLAG_READ)) {
|
if (s->is_multicast && !(h->flags & AVIO_WRONLY)) {
|
||||||
bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
|
bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
|
||||||
}
|
}
|
||||||
/* bind to the local address if not multicast or if the multicast
|
/* bind to the local address if not multicast or if the multicast
|
||||||
@@ -474,7 +477,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
|
|||||||
s->local_port = udp_port(&my_addr, len);
|
s->local_port = udp_port(&my_addr, len);
|
||||||
|
|
||||||
if (s->is_multicast) {
|
if (s->is_multicast) {
|
||||||
if (!(h->flags & AVIO_FLAG_READ)) {
|
if (h->flags & AVIO_WRONLY) {
|
||||||
/* output */
|
/* output */
|
||||||
if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
|
if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -489,7 +492,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
|
|||||||
/* limit the tx buf size to limit latency */
|
/* limit the tx buf size to limit latency */
|
||||||
tmp = s->buffer_size;
|
tmp = s->buffer_size;
|
||||||
if (setsockopt(udp_fd, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp)) < 0) {
|
if (setsockopt(udp_fd, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp)) < 0) {
|
||||||
av_log(h, AV_LOG_ERROR, "setsockopt(SO_SNDBUF): %s\n", strerror(errno));
|
av_log(NULL, AV_LOG_ERROR, "setsockopt(SO_SNDBUF): %s\n", strerror(errno));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -497,14 +500,14 @@ static int udp_open(URLContext *h, const char *uri, int flags)
|
|||||||
* avoid losing data on OSes that set this too low by default. */
|
* avoid losing data on OSes that set this too low by default. */
|
||||||
tmp = s->buffer_size;
|
tmp = s->buffer_size;
|
||||||
if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) {
|
if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) {
|
||||||
av_log(h, AV_LOG_WARNING, "setsockopt(SO_RECVBUF): %s\n", strerror(errno));
|
av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_RECVBUF): %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
/* make the socket non-blocking */
|
/* make the socket non-blocking */
|
||||||
ff_socket_nonblock(udp_fd, 1);
|
ff_socket_nonblock(udp_fd, 1);
|
||||||
}
|
}
|
||||||
if (s->is_connected) {
|
if (s->is_connected) {
|
||||||
if (connect(udp_fd, (struct sockaddr *) &s->dest_addr, s->dest_addr_len)) {
|
if (connect(udp_fd, (struct sockaddr *) &s->dest_addr, s->dest_addr_len)) {
|
||||||
av_log(h, AV_LOG_ERROR, "connect: %s\n", strerror(errno));
|
av_log(NULL, AV_LOG_ERROR, "connect: %s\n", strerror(errno));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -597,7 +600,7 @@ static int udp_close(URLContext *h)
|
|||||||
{
|
{
|
||||||
UDPContext *s = h->priv_data;
|
UDPContext *s = h->priv_data;
|
||||||
|
|
||||||
if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
|
if (s->is_multicast && !(h->flags & AVIO_WRONLY))
|
||||||
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
|
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
|
||||||
closesocket(s->udp_fd);
|
closesocket(s->udp_fd);
|
||||||
av_fifo_free(s->fifo);
|
av_fifo_free(s->fifo);
|
||||||
|
@@ -118,9 +118,15 @@ static void av_frac_add(AVFrac *f, int64_t incr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** head of registered input format linked list */
|
/** head of registered input format linked list */
|
||||||
static AVInputFormat *first_iformat = NULL;
|
#if !FF_API_FIRST_FORMAT
|
||||||
|
static
|
||||||
|
#endif
|
||||||
|
AVInputFormat *first_iformat = NULL;
|
||||||
/** head of registered output format linked list */
|
/** head of registered output format linked list */
|
||||||
static AVOutputFormat *first_oformat = NULL;
|
#if !FF_API_FIRST_FORMAT
|
||||||
|
static
|
||||||
|
#endif
|
||||||
|
AVOutputFormat *first_oformat = NULL;
|
||||||
|
|
||||||
AVInputFormat *av_iformat_next(AVInputFormat *f)
|
AVInputFormat *av_iformat_next(AVInputFormat *f)
|
||||||
{
|
{
|
||||||
@@ -197,6 +203,14 @@ static int match_format(const char *name, const char *names)
|
|||||||
return !strcasecmp(name, names);
|
return !strcasecmp(name, names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_GUESS_FORMAT
|
||||||
|
AVOutputFormat *guess_format(const char *short_name, const char *filename,
|
||||||
|
const char *mime_type)
|
||||||
|
{
|
||||||
|
return av_guess_format(short_name, filename, mime_type);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
|
AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
|
||||||
const char *mime_type)
|
const char *mime_type)
|
||||||
{
|
{
|
||||||
@@ -232,6 +246,27 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
|
|||||||
return fmt_found;
|
return fmt_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_GUESS_FORMAT
|
||||||
|
AVOutputFormat *guess_stream_format(const char *short_name, const char *filename,
|
||||||
|
const char *mime_type)
|
||||||
|
{
|
||||||
|
AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type);
|
||||||
|
|
||||||
|
if (fmt) {
|
||||||
|
AVOutputFormat *stream_fmt;
|
||||||
|
char stream_format_name[64];
|
||||||
|
|
||||||
|
snprintf(stream_format_name, sizeof(stream_format_name), "%s_stream", fmt->name);
|
||||||
|
stream_fmt = av_guess_format(stream_format_name, NULL, NULL);
|
||||||
|
|
||||||
|
if (stream_fmt)
|
||||||
|
fmt = stream_fmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
|
enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
|
||||||
const char *filename, const char *mime_type, enum AVMediaType type){
|
const char *filename, const char *mime_type, enum AVMediaType type){
|
||||||
if(type == AVMEDIA_TYPE_VIDEO){
|
if(type == AVMEDIA_TYPE_VIDEO){
|
||||||
@@ -263,6 +298,38 @@ AVInputFormat *av_find_input_format(const char *short_name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_SYMVER && CONFIG_SHARED && HAVE_SYMVER
|
||||||
|
FF_SYMVER(void, av_destruct_packet_nofree, (AVPacket *pkt), "LIBAVFORMAT_52")
|
||||||
|
{
|
||||||
|
av_destruct_packet_nofree(pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
FF_SYMVER(void, av_destruct_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
|
||||||
|
{
|
||||||
|
av_destruct_packet(pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
FF_SYMVER(int, av_new_packet, (AVPacket *pkt, int size), "LIBAVFORMAT_52")
|
||||||
|
{
|
||||||
|
return av_new_packet(pkt, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
FF_SYMVER(int, av_dup_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
|
||||||
|
{
|
||||||
|
return av_dup_packet(pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
FF_SYMVER(void, av_free_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
|
||||||
|
{
|
||||||
|
av_free_packet(pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
FF_SYMVER(void, av_init_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
|
||||||
|
{
|
||||||
|
av_log(NULL, AV_LOG_WARNING, "Diverting av_*_packet function calls to libavcodec. Recompile to improve performance\n");
|
||||||
|
av_init_packet(pkt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
|
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
|
||||||
{
|
{
|
||||||
@@ -468,6 +535,9 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
|
|||||||
|
|
||||||
err = avformat_open_input(ic_ptr, filename, fmt, &opts);
|
err = avformat_open_input(ic_ptr, filename, fmt, &opts);
|
||||||
|
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
ff_metadata_demux_compat(ic);
|
||||||
|
#endif
|
||||||
fail:
|
fail:
|
||||||
av_dict_free(&opts);
|
av_dict_free(&opts);
|
||||||
return err;
|
return err;
|
||||||
@@ -591,7 +661,8 @@ static int init_input(AVFormatContext *s, const char *filename)
|
|||||||
if (!s->iformat)
|
if (!s->iformat)
|
||||||
return av_probe_input_buffer(s->pb, &s->iformat, filename, s, 0, 0);
|
return av_probe_input_buffer(s->pb, &s->iformat, filename, s, 0, 0);
|
||||||
else if (s->iformat->flags & AVFMT_NOFILE)
|
else if (s->iformat->flags & AVFMT_NOFILE)
|
||||||
return AVERROR(EINVAL);
|
av_log(s, AV_LOG_WARNING, "Custom AVIOContext makes no sense and "
|
||||||
|
"will be ignored with AVFMT_NOFILE format.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,7 +670,7 @@ static int init_input(AVFormatContext *s, const char *filename)
|
|||||||
(!s->iformat && (s->iformat = av_probe_input_format(&pd, 0))))
|
(!s->iformat && (s->iformat = av_probe_input_format(&pd, 0))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((ret = avio_open(&s->pb, filename, AVIO_FLAG_READ)) < 0)
|
if ((ret = avio_open(&s->pb, filename, AVIO_RDONLY)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (s->iformat)
|
if (s->iformat)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -729,8 +800,6 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA))
|
|
||||||
av_packet_merge_side_data(pkt);
|
|
||||||
st= s->streams[pkt->stream_index];
|
st= s->streams[pkt->stream_index];
|
||||||
|
|
||||||
switch(st->codec->codec_type){
|
switch(st->codec->codec_type){
|
||||||
@@ -2647,24 +2716,34 @@ void avformat_free_context(AVFormatContext *s)
|
|||||||
av_free(st->codec->extradata);
|
av_free(st->codec->extradata);
|
||||||
av_free(st->codec->subtitle_header);
|
av_free(st->codec->subtitle_header);
|
||||||
av_free(st->codec);
|
av_free(st->codec);
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
av_free(st->filename);
|
||||||
|
#endif
|
||||||
av_free(st->priv_data);
|
av_free(st->priv_data);
|
||||||
av_free(st->info);
|
av_free(st->info);
|
||||||
av_free(st);
|
av_free(st);
|
||||||
}
|
}
|
||||||
for(i=s->nb_programs-1; i>=0; i--) {
|
for(i=s->nb_programs-1; i>=0; i--) {
|
||||||
av_dict_free(&s->programs[i]->metadata);
|
#if FF_API_OLD_METADATA
|
||||||
|
av_freep(&s->programs[i]->provider_name);
|
||||||
|
av_freep(&s->programs[i]->name);
|
||||||
|
#endif
|
||||||
|
av_metadata_free(&s->programs[i]->metadata);
|
||||||
av_freep(&s->programs[i]->stream_index);
|
av_freep(&s->programs[i]->stream_index);
|
||||||
av_freep(&s->programs[i]);
|
av_freep(&s->programs[i]);
|
||||||
}
|
}
|
||||||
av_freep(&s->programs);
|
av_freep(&s->programs);
|
||||||
av_freep(&s->priv_data);
|
av_freep(&s->priv_data);
|
||||||
while(s->nb_chapters--) {
|
while(s->nb_chapters--) {
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
av_free(s->chapters[s->nb_chapters]->title);
|
||||||
|
#endif
|
||||||
av_dict_free(&s->chapters[s->nb_chapters]->metadata);
|
av_dict_free(&s->chapters[s->nb_chapters]->metadata);
|
||||||
av_free(s->chapters[s->nb_chapters]);
|
av_free(s->chapters[s->nb_chapters]);
|
||||||
}
|
}
|
||||||
av_freep(&s->chapters);
|
av_freep(&s->chapters);
|
||||||
av_dict_free(&s->metadata);
|
av_metadata_free(&s->metadata);
|
||||||
av_freep(&s->streams);
|
// av_freep(&s->key);
|
||||||
av_free(s);
|
av_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2681,6 +2760,13 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
|
|||||||
{
|
{
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#if FF_API_MAX_STREAMS
|
||||||
|
if (s->nb_streams >= MAX_STREAMS){
|
||||||
|
av_log(s, AV_LOG_ERROR, "Too many streams\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
AVStream **streams;
|
AVStream **streams;
|
||||||
|
|
||||||
if (s->nb_streams >= INT_MAX/sizeof(*streams))
|
if (s->nb_streams >= INT_MAX/sizeof(*streams))
|
||||||
@@ -2689,6 +2775,7 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
|
|||||||
if (!streams)
|
if (!streams)
|
||||||
return NULL;
|
return NULL;
|
||||||
s->streams = streams;
|
s->streams = streams;
|
||||||
|
#endif
|
||||||
|
|
||||||
st = av_mallocz(sizeof(AVStream));
|
st = av_mallocz(sizeof(AVStream));
|
||||||
if (!st)
|
if (!st)
|
||||||
@@ -2766,6 +2853,9 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int6
|
|||||||
return NULL;
|
return NULL;
|
||||||
dynarray_add(&s->chapters, &s->nb_chapters, chapter);
|
dynarray_add(&s->chapters, &s->nb_chapters, chapter);
|
||||||
}
|
}
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
av_free(chapter->title);
|
||||||
|
#endif
|
||||||
av_dict_set(&chapter->metadata, "title", title, 0);
|
av_dict_set(&chapter->metadata, "title", title, 0);
|
||||||
chapter->id = id;
|
chapter->id = id;
|
||||||
chapter->time_base= time_base;
|
chapter->time_base= time_base;
|
||||||
@@ -2988,6 +3078,10 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_OLD_METADATA
|
||||||
|
ff_metadata_mux_compat(s);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* set muxer identification string */
|
/* set muxer identification string */
|
||||||
if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
|
if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
|
||||||
av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
|
av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
|
||||||
@@ -3492,6 +3586,24 @@ void av_dump_format(AVFormatContext *ic,
|
|||||||
av_free(printed);
|
av_free(printed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_PARSE_FRAME_PARAM
|
||||||
|
#include "libavutil/parseutils.h"
|
||||||
|
|
||||||
|
int parse_image_size(int *width_ptr, int *height_ptr, const char *str)
|
||||||
|
{
|
||||||
|
return av_parse_video_size(width_ptr, height_ptr, str);
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_frame_rate(int *frame_rate_num, int *frame_rate_den, const char *arg)
|
||||||
|
{
|
||||||
|
AVRational frame_rate;
|
||||||
|
int ret = av_parse_video_rate(&frame_rate, arg);
|
||||||
|
*frame_rate_num= frame_rate.num;
|
||||||
|
*frame_rate_den= frame_rate.den;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int64_t av_gettime(void)
|
int64_t av_gettime(void)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@@ -3671,6 +3783,24 @@ void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
|
|||||||
pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
|
pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_URL_SPLIT
|
||||||
|
attribute_deprecated
|
||||||
|
void ff_url_split(char *proto, int proto_size,
|
||||||
|
char *authorization, int authorization_size,
|
||||||
|
char *hostname, int hostname_size,
|
||||||
|
int *port_ptr,
|
||||||
|
char *path, int path_size,
|
||||||
|
const char *url)
|
||||||
|
{
|
||||||
|
av_url_split(proto, proto_size,
|
||||||
|
authorization, authorization_size,
|
||||||
|
hostname, hostname_size,
|
||||||
|
port_ptr,
|
||||||
|
path, path_size,
|
||||||
|
url);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void av_url_split(char *proto, int proto_size,
|
void av_url_split(char *proto, int proto_size,
|
||||||
char *authorization, int authorization_size,
|
char *authorization, int authorization_size,
|
||||||
char *hostname, int hostname_size,
|
char *hostname, int hostname_size,
|
||||||
|
@@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_MAJOR 53
|
#define LIBAVFORMAT_VERSION_MAJOR 52
|
||||||
#define LIBAVFORMAT_VERSION_MINOR 4
|
#define LIBAVFORMAT_VERSION_MINOR 110
|
||||||
#define LIBAVFORMAT_VERSION_MICRO 0
|
#define LIBAVFORMAT_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||||
@@ -41,15 +41,60 @@
|
|||||||
* Those FF_API_* defines are not part of public API.
|
* Those FF_API_* defines are not part of public API.
|
||||||
* They may change, break or disappear at any time.
|
* They may change, break or disappear at any time.
|
||||||
*/
|
*/
|
||||||
|
#ifndef FF_API_MAX_STREAMS
|
||||||
|
#define FF_API_MAX_STREAMS (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_OLD_METADATA
|
||||||
|
#define FF_API_OLD_METADATA (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
#ifndef FF_API_OLD_METADATA2
|
#ifndef FF_API_OLD_METADATA2
|
||||||
#define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54)
|
#define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_URL_CLASS
|
||||||
|
#define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_URL_RESETBUF
|
||||||
|
#define FF_API_URL_RESETBUF (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_REGISTER_PROTOCOL
|
||||||
|
#define FF_API_REGISTER_PROTOCOL (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_GUESS_FORMAT
|
||||||
|
#define FF_API_GUESS_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_UDP_GET_FILE
|
||||||
|
#define FF_API_UDP_GET_FILE (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_URL_SPLIT
|
||||||
|
#define FF_API_URL_SPLIT (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_ALLOC_FORMAT_CONTEXT
|
||||||
|
#define FF_API_ALLOC_FORMAT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_PARSE_FRAME_PARAM
|
||||||
|
#define FF_API_PARSE_FRAME_PARAM (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
#ifndef FF_API_READ_SEEK
|
#ifndef FF_API_READ_SEEK
|
||||||
#define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54)
|
#define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_LAVF_UNUSED
|
||||||
|
#define FF_API_LAVF_UNUSED (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_PARAMETERS_CODEC_ID
|
||||||
|
#define FF_API_PARAMETERS_CODEC_ID (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_FIRST_FORMAT
|
||||||
|
#define FF_API_FIRST_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_SYMVER
|
||||||
|
#define FF_API_SYMVER (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
#ifndef FF_API_OLD_AVIO
|
#ifndef FF_API_OLD_AVIO
|
||||||
#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54)
|
#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_INDEX_BUILT
|
||||||
|
#define FF_API_INDEX_BUILT (LIBAVFORMAT_VERSION_MAJOR < 53)
|
||||||
|
#endif
|
||||||
#ifndef FF_API_DUMP_FORMAT
|
#ifndef FF_API_DUMP_FORMAT
|
||||||
#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54)
|
#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||||
#endif
|
#endif
|
||||||
|
@@ -36,6 +36,7 @@ HEADERS = adler32.h \
|
|||||||
rational.h \
|
rational.h \
|
||||||
samplefmt.h \
|
samplefmt.h \
|
||||||
sha.h \
|
sha.h \
|
||||||
|
sha1.h \
|
||||||
|
|
||||||
BUILT_HEADERS = avconfig.h
|
BUILT_HEADERS = avconfig.h
|
||||||
|
|
||||||
|
@@ -39,9 +39,9 @@
|
|||||||
#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
|
#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
|
||||||
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
|
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_MAJOR 51
|
#define LIBAVUTIL_VERSION_MAJOR 50
|
||||||
#define LIBAVUTIL_VERSION_MINOR 9
|
#define LIBAVUTIL_VERSION_MINOR 43
|
||||||
#define LIBAVUTIL_VERSION_MICRO 1
|
#define LIBAVUTIL_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||||
LIBAVUTIL_VERSION_MINOR, \
|
LIBAVUTIL_VERSION_MINOR, \
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef FF_API_OLD_EVAL_NAMES
|
#ifndef FF_API_OLD_EVAL_NAMES
|
||||||
#define FF_API_OLD_EVAL_NAMES (LIBAVUTIL_VERSION_MAJOR < 52)
|
#define FF_API_OLD_EVAL_NAMES (LIBAVUTIL_VERSION_MAJOR < 52)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT
|
#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT
|
||||||
#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 52)
|
#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 52)
|
||||||
@@ -103,6 +104,13 @@ enum AVMediaType {
|
|||||||
#define AV_TIME_BASE 1000000
|
#define AV_TIME_BASE 1000000
|
||||||
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
|
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Those FF_API_* defines are not part of public API.
|
||||||
|
* They may change, break or disappear at any time.
|
||||||
|
*/
|
||||||
|
#ifndef FF_API_OLD_IMAGE_NAMES
|
||||||
|
#define FF_API_OLD_IMAGE_NAMES (LIBAVUTIL_VERSION_MAJOR < 51)
|
||||||
|
#endif
|
||||||
enum AVPictureType {
|
enum AVPictureType {
|
||||||
AV_PICTURE_TYPE_I = 1, ///< Intra
|
AV_PICTURE_TYPE_I = 1, ///< Intra
|
||||||
AV_PICTURE_TYPE_P, ///< Predicted
|
AV_PICTURE_TYPE_P, ///< Predicted
|
||||||
|
@@ -26,19 +26,20 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
|
|||||||
const char *errstr = NULL;
|
const char *errstr = NULL;
|
||||||
|
|
||||||
switch (errnum) {
|
switch (errnum) {
|
||||||
case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found" ; break;
|
case AVERROR_EOF: errstr = "End of file"; break;
|
||||||
case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found" ; break;
|
case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break;
|
||||||
case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found" ; break;
|
case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break;
|
||||||
case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found" ; break;
|
case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in Libav, patches welcome"; break;
|
||||||
case AVERROR_EOF: errstr = "End of file" ; break;
|
case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found"; break;
|
||||||
case AVERROR_EXIT: errstr = "Immediate exit requested" ; break;
|
case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found"; break;
|
||||||
case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found" ; break;
|
case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found"; break;
|
||||||
case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input" ; break;
|
case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found"; break;
|
||||||
case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found" ; break;
|
case AVERROR_OPTION_NOT_FOUND: errstr = "Option not found"; break;
|
||||||
case AVERROR_OPTION_NOT_FOUND: errstr = "Option not found" ; break;
|
case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found"; break;
|
||||||
case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
|
case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found"; break;
|
||||||
case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found" ; break;
|
case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found"; break;
|
||||||
case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found" ; break;
|
case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found"; break;
|
||||||
|
case AVERROR_EXIT: errstr = "Immediate exit requested"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errstr) {
|
if (errstr) {
|
||||||
|
@@ -37,17 +37,37 @@
|
|||||||
#define AVUNERROR(e) (e)
|
#define AVUNERROR(e) (e)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LIBAVUTIL_VERSION_MAJOR < 51
|
||||||
|
#define AVERROR_INVALIDDATA AVERROR(EINVAL) ///< Invalid data found when processing input
|
||||||
|
#define AVERROR_IO AVERROR(EIO) ///< I/O error
|
||||||
|
#define AVERROR_NOENT AVERROR(ENOENT) ///< No such file or directory
|
||||||
|
#define AVERROR_NOFMT AVERROR(EILSEQ) ///< Unknown format
|
||||||
|
#define AVERROR_NOMEM AVERROR(ENOMEM) ///< Not enough memory
|
||||||
|
#define AVERROR_NOTSUPP AVERROR(ENOSYS) ///< Operation not supported
|
||||||
|
#define AVERROR_NUMEXPECTED AVERROR(EDOM) ///< Number syntax expected in filename
|
||||||
|
#define AVERROR_UNKNOWN AVERROR(EINVAL) ///< Unknown error
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AVERROR_EOF AVERROR(EPIPE) ///< End of file
|
||||||
|
|
||||||
|
#define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in Libav, patches welcome
|
||||||
|
|
||||||
|
#if LIBAVUTIL_VERSION_MAJOR > 50
|
||||||
|
#define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input
|
||||||
|
#define AVERROR_NUMEXPECTED (-MKTAG('N','U','E','X')) ///< Number syntax expected in filename
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found
|
||||||
|
#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found
|
||||||
|
|
||||||
#define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found
|
#define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found
|
||||||
#define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found
|
#define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found
|
||||||
#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found
|
#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found
|
||||||
#define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found
|
#define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found
|
||||||
#define AVERROR_EOF (-MKTAG( 'E','O','F',' ')) ///< End of file
|
|
||||||
#define AVERROR_EXIT (-MKTAG( 'E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted
|
#define AVERROR_EXIT (-MKTAG( 'E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted
|
||||||
#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found
|
#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found
|
||||||
#define AVERROR_INVALIDDATA (-MKTAG( 'I','N','D','A')) ///< Invalid data found when processing input
|
|
||||||
#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found
|
#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found
|
||||||
#define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8,'O','P','T')) ///< Option not found
|
#define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8,'O','P','T')) ///< Option not found
|
||||||
#define AVERROR_PATCHWELCOME (-MKTAG( 'P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome
|
|
||||||
#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found
|
#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found
|
||||||
#define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8,'S','T','R')) ///< Stream not found
|
#define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8,'S','T','R')) ///< Stream not found
|
||||||
|
|
||||||
|
@@ -47,6 +47,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
|
|||||||
av_unused void *ptr;
|
av_unused void *ptr;
|
||||||
off_t off_size;
|
off_t off_size;
|
||||||
char errbuf[128];
|
char errbuf[128];
|
||||||
|
size_t max_size = HAVE_MMAP ? SIZE_MAX : FF_INTERNAL_MEM_TYPE_MAX_VALUE;
|
||||||
*bufptr = NULL;
|
*bufptr = NULL;
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
@@ -65,7 +66,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
off_size = st.st_size;
|
off_size = st.st_size;
|
||||||
if (off_size > SIZE_MAX) {
|
if (off_size > max_size) {
|
||||||
av_log(&file_log_ctx, AV_LOG_ERROR,
|
av_log(&file_log_ctx, AV_LOG_ERROR,
|
||||||
"File size for file '%s' is too big\n", filename);
|
"File size for file '%s' is too big\n", filename);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@@ -274,3 +274,32 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FF_API_OLD_IMAGE_NAMES
|
||||||
|
void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
|
||||||
|
const AVPixFmtDescriptor *pixdesc)
|
||||||
|
{
|
||||||
|
av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane)
|
||||||
|
{
|
||||||
|
return av_image_get_linesize(pix_fmt, width, plane);
|
||||||
|
}
|
||||||
|
|
||||||
|
int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
|
||||||
|
{
|
||||||
|
return av_image_fill_linesizes(linesizes, pix_fmt, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
|
||||||
|
uint8_t *ptr, const int linesizes[4])
|
||||||
|
{
|
||||||
|
return av_image_fill_pointers(data, pix_fmt, height, ptr, linesizes);
|
||||||
|
}
|
||||||
|
|
||||||
|
int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
|
||||||
|
{
|
||||||
|
return av_image_check_size(w, h, log_offset, log_ctx);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -127,4 +127,23 @@ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *lo
|
|||||||
|
|
||||||
int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt);
|
int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt);
|
||||||
|
|
||||||
|
#if FF_API_OLD_IMAGE_NAMES
|
||||||
|
attribute_deprecated
|
||||||
|
void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
|
||||||
|
const AVPixFmtDescriptor *pixdesc);
|
||||||
|
|
||||||
|
attribute_deprecated
|
||||||
|
int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane);
|
||||||
|
|
||||||
|
attribute_deprecated
|
||||||
|
int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
|
||||||
|
|
||||||
|
attribute_deprecated
|
||||||
|
int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
|
||||||
|
uint8_t *ptr, const int linesizes[4]);
|
||||||
|
|
||||||
|
attribute_deprecated
|
||||||
|
int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* AVUTIL_IMGUTILS_H */
|
#endif /* AVUTIL_IMGUTILS_H */
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user