Originally committed as revision 5146 to svn://svn.ffmpeg.org/ffmpeg/trunk
- if (!ap || ap->sample_rate <= 0 || ap->channels <= 0)
+ if (ap->sample_rate <= 0 || ap->channels <= 0)
return -1;
st = av_new_stream(s1, 0);
return -1;
st = av_new_stream(s1, 0);
const char *video_device;
int j;
const char *video_device;
int j;
- if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
+ if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
return -1;
width = ap->width;
return -1;
width = ap->width;
int format = -1;
const char *video_device;
int format = -1;
const char *video_device;
- if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
+ if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
return -1;
width = ap->width;
return -1;
width = ap->width;
- if (ap && ap->image_format)
s->img_fmt = ap->image_format;
pstrcpy(s->path, sizeof(s->path), s1->filename);
s->img_fmt = ap->image_format;
pstrcpy(s->path, sizeof(s->path), s1->filename);
- if (!ap || !ap->time_base.num) {
+ if (!ap->time_base.num) {
st->codec->time_base= (AVRational){1,25};
} else {
st->codec->time_base= ap->time_base;
st->codec->time_base= (AVRational){1,25};
} else {
st->codec->time_base= ap->time_base;
int i;
/* find output image format */
int i;
/* find output image format */
- if (ap && ap->image_format) {
+ if (ap->image_format) {
img_fmt = ap->image_format;
} else {
img_fmt = guess_image_format(s->filename);
img_fmt = ap->image_format;
} else {
img_fmt = guess_image_format(s->filename);
- if (!ap || !ap->time_base.num) {
+ if (!ap->time_base.num) {
av_set_pts_info(st, 60, 1, 25);
} else {
av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
}
av_set_pts_info(st, 60, 1, 25);
} else {
av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
}
- if(ap && ap->width && ap->height){
+ if(ap->width && ap->height){
st->codec->width = ap->width;
st->codec->height= ap->height;
}
st->codec->width = ap->width;
st->codec->height= ap->height;
}
st = av_new_stream(s, 0);
if (!st)
return AVERROR_NOMEM;
st = av_new_stream(s, 0);
if (!st)
return AVERROR_NOMEM;
id = s->iformat->value;
if (id == CODEC_ID_RAWVIDEO) {
st->codec->codec_type = CODEC_TYPE_VIDEO;
id = s->iformat->value;
if (id == CODEC_ID_RAWVIDEO) {
st->codec->codec_type = CODEC_TYPE_VIDEO;
- } else {
- return -1;
- }
/* for mjpeg, specify frame rate */
/* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
/* for mjpeg, specify frame rate */
/* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
- if (ap && ap->time_base.num) {
+ if (ap->time_base.num) {
av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
} else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
st->codec->codec_id == CODEC_ID_MPEG4 ||
av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
} else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
st->codec->codec_id == CODEC_ID_MPEG4 ||
rt->state = RTSP_STATE_IDLE;
rt->seek_timestamp = 0; /* default is to start stream at position
zero */
rt->state = RTSP_STATE_IDLE;
rt->seek_timestamp = 0; /* default is to start stream at position
zero */
- if (ap && ap->initial_pause) {
+ if (ap->initial_pause) {
/* do not start immediately */
} else {
if (rtsp_read_play(s) < 0) {
/* do not start immediately */
} else {
if (rtsp_read_play(s) < 0) {
{
int err;
AVFormatContext *ic;
{
int err;
AVFormatContext *ic;
+ AVFormatParameters default_ap;
+
+ if(!ap){
+ ap=&default_ap;
+ memset(ap, 0, sizeof(default_ap));
+ }
ic = av_alloc_format_context();
if (!ic) {
ic = av_alloc_format_context();
if (!ic) {
uint32_t desired_format, capabilities;
const char *video_device;
uint32_t desired_format, capabilities;
const char *video_device;
- if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
+ if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
av_log(s1, AV_LOG_ERROR, "Missing/Wrong parameters\n");
return -1;
av_log(s1, AV_LOG_ERROR, "Missing/Wrong parameters\n");
return -1;