~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavfilter/vsrc_movie.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
#define OFFSET(x) offsetof(MovieContext, x)
58
58
 
59
59
static const AVOption movie_options[]= {
60
 
{"format_name",  "set format name",         OFFSET(format_name),  FF_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
61
 
{"f",            "set format name",         OFFSET(format_name),  FF_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
62
 
{"stream_index", "set stream index",        OFFSET(stream_index), FF_OPT_TYPE_INT,    {.dbl = -1},  -1,       INT_MAX  },
63
 
{"si",           "set stream index",        OFFSET(stream_index), FF_OPT_TYPE_INT,    {.dbl = -1},  -1,       INT_MAX  },
64
 
{"seek_point",   "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, {.dbl =  0},  0,        (INT64_MAX-1) / 1000000 },
65
 
{"sp",           "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, {.dbl =  0},  0,        (INT64_MAX-1) / 1000000 },
 
60
{"format_name",  "set format name",         OFFSET(format_name),  AV_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
 
61
{"f",            "set format name",         OFFSET(format_name),  AV_OPT_TYPE_STRING, {.str =  0},  CHAR_MIN, CHAR_MAX },
 
62
{"stream_index", "set stream index",        OFFSET(stream_index), AV_OPT_TYPE_INT,    {.dbl = -1},  -1,       INT_MAX  },
 
63
{"si",           "set stream index",        OFFSET(stream_index), AV_OPT_TYPE_INT,    {.dbl = -1},  -1,       INT_MAX  },
 
64
{"seek_point",   "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl =  0},  0,        (INT64_MAX-1) / 1000000 },
 
65
{"sp",           "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl =  0},  0,        (INT64_MAX-1) / 1000000 },
66
66
{NULL},
67
67
};
68
68
 
96
96
               "Failed to avformat_open_input '%s'\n", movie->file_name);
97
97
        return ret;
98
98
    }
99
 
    if ((ret = av_find_stream_info(movie->format_ctx)) < 0)
 
99
    if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0)
100
100
        av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
101
101
 
102
102
    // if seeking requested, we execute it
139
139
        return AVERROR(EINVAL);
140
140
    }
141
141
 
142
 
    if ((ret = avcodec_open(movie->codec_ctx, codec)) < 0) {
 
142
    if ((ret = avcodec_open2(movie->codec_ctx, codec, NULL)) < 0) {
143
143
        av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
144
144
        return ret;
145
145
    }
164
164
    MovieContext *movie = ctx->priv;
165
165
    int ret;
166
166
    movie->class = &movie_class;
167
 
    av_opt_set_defaults2(movie, 0, 0);
 
167
    av_opt_set_defaults(movie);
168
168
 
169
169
    if (args)
170
170
        movie->file_name = av_get_token(&args, ":");
192
192
    if (movie->codec_ctx)
193
193
        avcodec_close(movie->codec_ctx);
194
194
    if (movie->format_ctx)
195
 
        av_close_input_file(movie->format_ctx);
 
195
        avformat_close_input(&movie->format_ctx);
196
196
    avfilter_unref_buffer(movie->picref);
197
197
    av_freep(&movie->frame);
198
198
}
240
240
                av_image_copy(movie->picref->data, movie->picref->linesize,
241
241
                              movie->frame->data,  movie->frame->linesize,
242
242
                              movie->picref->format, outlink->w, outlink->h);
 
243
                avfilter_copy_frame_props(movie->picref, movie->frame);
243
244
 
244
245
                /* FIXME: use a PTS correction mechanism as that in
245
246
                 * ffplay.c when some API will be available for that */
248
249
                    movie->frame->pkt_dts : movie->frame->pkt_pts;
249
250
 
250
251
                movie->picref->pos                    = movie->frame->reordered_opaque;
251
 
                movie->picref->video->pixel_aspect = st->sample_aspect_ratio.num ?
252
 
                    st->sample_aspect_ratio : movie->codec_ctx->sample_aspect_ratio;
253
 
                movie->picref->video->interlaced      = movie->frame->interlaced_frame;
254
 
                movie->picref->video->top_field_first = movie->frame->top_field_first;
255
 
                movie->picref->video->key_frame       = movie->frame->key_frame;
256
 
                movie->picref->video->pict_type       = movie->frame->pict_type;
 
252
                if (!movie->frame->sample_aspect_ratio.num)
 
253
                    movie->picref->video->pixel_aspect = st->sample_aspect_ratio;
257
254
                av_dlog(outlink->src,
258
255
                        "movie_get_frame(): file:'%s' pts:%"PRId64" time:%lf pos:%"PRId64" aspect:%d/%d\n",
259
256
                        movie->file_name, movie->picref->pts,