History

Merge remote-tracking branch 'qatar/master'

* qatar/master: build: remove empty $(OBJS) target build: make rule for linking ff* apply only to these targets build: rearrange some lines in a more logical way s302m: fix resampling for 16 and 24bits. ARM: remove MUL64 and MAC64 inline asm build: clean up .PHONY lists build: move all (un)install* target aliases to toplevel Makefile flvenc: propagate error properly build: remove stale dependency build: do not add CFLAGS-yes to CFLAGS utils.c: fix crash with threading enabled. configure: simplify source_path setup configure: remove --source-path option lavf: deprecate AVFormatParameters.time_base. img2: add framerate private option. img2: add video_size private option. img2: add pixel_format private option. tty: add framerate private option. Conflicts: Makefile configure

Michael Niedermayer committed 15 years ago

Commit 174df6a2 parents 3a1aaf7 b9c6c7c9 files · +86 −76Browse files

Showing the changes to libavformat (4 of 9 files). Show all

Unified · Split

4 files
  1. libavformat/avformat.h +1 −1
  2. libavformat/flvenc.c +1 −1
  3. libavformat/img2.c +59 −11
  4. libavformat/tty.c +10 −6
libavformat/avformat.h+1−1
@@ -227,8 +227,8 @@ typedef struct AVProbeData { · 226 unmodified lines
227#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer227#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer
228 228
229typedef struct AVFormatParameters {229typedef struct AVFormatParameters {
230 AVRational time_base;
231#if FF_API_FORMAT_PARAMETERS230#if FF_API_FORMAT_PARAMETERS
231 attribute_deprecated AVRational time_base;
232 attribute_deprecated int sample_rate;232 attribute_deprecated int sample_rate;
233 attribute_deprecated int channels;233 attribute_deprecated int channels;
234 attribute_deprecated int width;234 attribute_deprecated int width;
libavformat/flvenc.c+1−1
@@ -440,7 +440,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) · 439 unmodified lines
440 440
441 av_free(data);441 av_free(data);
442 442
443 return 0;443 return pb->error;
444}444}
445 445
446AVOutputFormat ff_flv_muxer = {446AVOutputFormat ff_flv_muxer = {
libavformat/img2.c+59−11
@@ -22,12 +22,17 @@ · 21 unmodified lines
22 22
23#include "libavutil/intreadwrite.h"23#include "libavutil/intreadwrite.h"
24#include "libavutil/avstring.h"24#include "libavutil/avstring.h"
25#include "libavutil/log.h"
26#include "libavutil/opt.h"
27#include "libavutil/pixdesc.h"
28#include "libavutil/parseutils.h"
25#include "avformat.h"29#include "avformat.h"
26#include "avio_internal.h"30#include "avio_internal.h"
27#include "internal.h"31#include "internal.h"
28#include <strings.h>32#include <strings.h>
29 33
30typedef struct {34typedef struct {
35 const AVClass *class; /**< Class for private options. */
31 int img_first;36 int img_first;
32 int img_last;37 int img_last;
33 int img_number;38 int img_number;
@@ -35,6 +40,9 @@ typedef struct { · 1 unmodified line
35 int is_pipe;40 int is_pipe;
36 int split_planes; /**< use independent file for each Y, U, V plane */41 int split_planes; /**< use independent file for each Y, U, V plane */
37 char path[1024];42 char path[1024];
43 char *pixel_format; /**< Set by a private option. */
44 char *video_size; /**< Set by a private option. */
45 char *framerate; /**< Set by a private option. */
38} VideoData;46} VideoData;
39 47
40typedef struct {48typedef struct {
@@ -202,8 +210,11 @@ enum CodecID av_guess_image2_codec(const char *filename){ · 161 unmodified lines
202static int read_header(AVFormatContext *s1, AVFormatParameters *ap)210static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
203{211{
204 VideoData *s = s1->priv_data;212 VideoData *s = s1->priv_data;
205 int first_index, last_index;213 int first_index, last_index, ret = 0;
214 int width = 0, height = 0;
206 AVStream *st;215 AVStream *st;
216 enum PixelFormat pix_fmt = PIX_FMT_NONE;
217 AVRational framerate;
207 218
208 s1->ctx_flags |= AVFMTCTX_NOHEADER;219 s1->ctx_flags |= AVFMTCTX_NOHEADER;
209 220
@@ -212,6 +223,29 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) · 2 unmodified lines
212 return AVERROR(ENOMEM);223 return AVERROR(ENOMEM);
213 }224 }
214 225
226 if (s->pixel_format && (pix_fmt = av_get_pix_fmt(s->pixel_format)) == PIX_FMT_NONE) {
227 av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n", s->pixel_format);
228 return AVERROR(EINVAL);
229 }
230 if (s->video_size && (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
231 av_log(s, AV_LOG_ERROR, "Could not parse video size: %s.\n", s->video_size);
232 return ret;
233 }
234 if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) {
235 av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate);
236 return ret;
237 }
238#if FF_API_FORMAT_PARAMETERS
239 if (ap->pix_fmt != PIX_FMT_NONE)
240 pix_fmt = ap->pix_fmt;
241 if (ap->width > 0)
242 width = ap->width;
243 if (ap->height > 0)
244 height = ap->height;
245 if (ap->time_base.num)
246 framerate = (AVRational){ap->time_base.den, ap->time_base.num};
247#endif
248
215 av_strlcpy(s->path, s1->filename, sizeof(s->path));249 av_strlcpy(s->path, s1->filename, sizeof(s->path));
216 s->img_number = 0;250 s->img_number = 0;
217 s->img_count = 0;251 s->img_count = 0;
@@ -224,15 +258,11 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) · 6 unmodified lines
224 st->need_parsing = AVSTREAM_PARSE_FULL;258 st->need_parsing = AVSTREAM_PARSE_FULL;
225 }259 }
226 260
227 if (!ap->time_base.num) {261 av_set_pts_info(st, 60, framerate.den, framerate.num);
228 av_set_pts_info(st, 60, 1, 25);
229 } else {
230 av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
231 }
232 262
233 if(ap->width && ap->height){263 if (width && height) {
234 st->codec->width = ap->width;264 st->codec->width = width;
235 st->codec->height= ap->height;265 st->codec->height = height;
236 }266 }
237 267
238 if (!s->is_pipe) {268 if (!s->is_pipe) {
@@ -258,8 +288,8 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) · 19 unmodified lines
258 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;288 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
259 st->codec->codec_id = av_str2id(img_tags, s->path);289 st->codec->codec_id = av_str2id(img_tags, s->path);
260 }290 }
261 if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE)291 if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != PIX_FMT_NONE)
262 st->codec->pix_fmt = ap->pix_fmt;292 st->codec->pix_fmt = pix_fmt;
263 293
264 return 0;294 return 0;
265}295}
@@ -430,6 +460,22 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) · 164 unmodified lines
430 460
431#endif /* CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER */461#endif /* CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER */
432 462
463#define OFFSET(x) offsetof(VideoData, x)
464#define DEC AV_OPT_FLAG_DECODING_PARAM
465static const AVOption options[] = {
466 { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
467 { "video_size", "", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
468 { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
469 { NULL },
470};
471
472static const AVClass img2_class = {
473 .class_name = "image2 demuxer",
474 .item_name = av_default_item_name,
475 .option = options,
476 .version = LIBAVUTIL_VERSION_INT,
477};
478
433/* input */479/* input */
434#if CONFIG_IMAGE2_DEMUXER480#if CONFIG_IMAGE2_DEMUXER
435AVInputFormat ff_image2_demuxer = {481AVInputFormat ff_image2_demuxer = {
@@ -440,6 +486,7 @@ AVInputFormat ff_image2_demuxer = { · 4 unmodified lines
440 .read_header = read_header,486 .read_header = read_header,
441 .read_packet = read_packet,487 .read_packet = read_packet,
442 .flags = AVFMT_NOFILE,488 .flags = AVFMT_NOFILE,
489 .priv_class = &img2_class,
443};490};
444#endif491#endif
445#if CONFIG_IMAGE2PIPE_DEMUXER492#if CONFIG_IMAGE2PIPE_DEMUXER
@@ -449,6 +496,7 @@ AVInputFormat ff_image2pipe_demuxer = { · 3 unmodified lines
449 .priv_data_size = sizeof(VideoData),496 .priv_data_size = sizeof(VideoData),
450 .read_header = read_header,497 .read_header = read_header,
451 .read_packet = read_packet,498 .read_packet = read_packet,
499 .priv_class = &img2_class,
452};500};
453#endif501#endif
454 502
libavformat/tty.c+10−6
@@ -37,6 +37,7 @@ typedef struct { · 36 unmodified lines
37 int chars_per_frame;37 int chars_per_frame;
38 uint64_t fsize; /**< file size less metadata buffer */38 uint64_t fsize; /**< file size less metadata buffer */
39 char *video_size;/**< A string describing video size, set by a private option. */39 char *video_size;/**< A string describing video size, set by a private option. */
40 char *framerate; /**< Set by a private option. */
40} TtyDemuxContext;41} TtyDemuxContext;
41 42
42/**43/**
@@ -75,6 +76,7 @@ static int read_header(AVFormatContext *avctx, · 32 unmodified lines
75 TtyDemuxContext *s = avctx->priv_data;76 TtyDemuxContext *s = avctx->priv_data;
76 int width = 0, height = 0, ret = 0;77 int width = 0, height = 0, ret = 0;
77 AVStream *st = av_new_stream(avctx, 0);78 AVStream *st = av_new_stream(avctx, 0);
79 AVRational framerate;
78 80
79 if (!st) {81 if (!st) {
80 ret = AVERROR(ENOMEM);82 ret = AVERROR(ENOMEM);
@@ -88,20 +90,21 @@ static int read_header(AVFormatContext *avctx, · 7 unmodified lines
88 av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");90 av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
89 goto fail;91 goto fail;
90 }92 }
93 if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) {
94 av_log(avctx, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate);
95 goto fail;
96 }
91#if FF_API_FORMAT_PARAMETERS97#if FF_API_FORMAT_PARAMETERS
92 if (ap->width > 0)98 if (ap->width > 0)
93 width = ap->width;99 width = ap->width;
94 if (ap->height > 0)100 if (ap->height > 0)
95 height = ap->height;101 height = ap->height;
102 if (ap->time_base.num)
103 framerate = (AVRational){ap->time_base.den, ap->time_base.num};
96#endif104#endif
97 st->codec->width = width;105 st->codec->width = width;
98 st->codec->height = height;106 st->codec->height = height;
99 107 av_set_pts_info(st, 60, framerate.den, framerate.num);
100 if (!ap->time_base.num) {
101 av_set_pts_info(st, 60, 1, 25);
102 } else {
103 av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
104 }
105 108
106 /* simulate tty display speed */109 /* simulate tty display speed */
107#if FF_API_FORMAT_PARAMETERS110#if FF_API_FORMAT_PARAMETERS
@@ -152,6 +155,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) · 44 unmodified lines
152static const AVOption options[] = {155static const AVOption options[] = {
153 { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), FF_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},156 { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), FF_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},
154 { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },157 { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
158 { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
155 { NULL },159 { NULL },
156};160};
157 161

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t