~ubuntu-branches/ubuntu/saucy/gst-libav1.0/saucy-proposed

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavformat/yop.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-07-30 09:00:15 UTC
  • mfrom: (1.1.16) (7.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20130730090015-sc1ou2yssu7q5w4e
Tags: 1.1.3-1
* New upstream development snapshot:
  + debian/control:
    - Build depend on GStreamer and gst-plugins-base >= 1.1.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
23
 */
24
24
 
 
25
#include "libavutil/channel_layout.h"
25
26
#include "libavutil/intreadwrite.h"
26
27
#include "avformat.h"
27
28
#include "internal.h"
47
48
    return 0;
48
49
}
49
50
 
50
 
static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
51
static int yop_read_header(AVFormatContext *s)
51
52
{
52
53
    YopDecContext *yop = s->priv_data;
53
54
    AVIOContext *pb  = s->pb;
72
73
    // Audio
73
74
    audio_dec               = audio_stream->codec;
74
75
    audio_dec->codec_type   = AVMEDIA_TYPE_AUDIO;
75
 
    audio_dec->codec_id     = CODEC_ID_ADPCM_IMA_WS;
 
76
    audio_dec->codec_id     = AV_CODEC_ID_ADPCM_IMA_APC;
76
77
    audio_dec->channels     = 1;
 
78
    audio_dec->channel_layout = AV_CH_LAYOUT_MONO;
77
79
    audio_dec->sample_rate  = 22050;
78
80
 
79
81
    // Video
80
82
    video_dec               = video_stream->codec;
81
83
    video_dec->codec_type   = AVMEDIA_TYPE_VIDEO;
82
 
    video_dec->codec_id     = CODEC_ID_YOP;
 
84
    video_dec->codec_id     = AV_CODEC_ID_YOP;
83
85
 
84
86
    avio_skip(pb, 6);
85
87
 
184
186
    int64_t frame_pos, pos_min, pos_max;
185
187
    int frame_count;
186
188
 
187
 
    av_free_packet(&yop->video_packet);
188
 
 
189
189
    if (!stream_index)
190
190
        return -1;
191
191
 
196
196
    timestamp      = FFMAX(0, FFMIN(frame_count, timestamp));
197
197
 
198
198
    frame_pos      = timestamp * yop->frame_size + pos_min;
 
199
 
 
200
    if (avio_seek(s->pb, frame_pos, SEEK_SET) < 0)
 
201
        return -1;
 
202
 
 
203
    av_free_packet(&yop->video_packet);
199
204
    yop->odd_frame = timestamp & 1;
200
205
 
201
 
    avio_seek(s->pb, frame_pos, SEEK_SET);
202
206
    return 0;
203
207
}
204
208
 
205
209
AVInputFormat ff_yop_demuxer = {
206
210
    .name           = "yop",
207
 
    .long_name      = NULL_IF_CONFIG_SMALL("Psygnosis YOP Format"),
 
211
    .long_name      = NULL_IF_CONFIG_SMALL("Psygnosis YOP"),
208
212
    .priv_data_size = sizeof(YopDecContext),
209
213
    .read_probe     = yop_probe,
210
214
    .read_header    = yop_read_header,
211
215
    .read_packet    = yop_read_packet,
212
216
    .read_close     = yop_read_close,
213
217
    .read_seek      = yop_read_seek,
214
 
    .extensions = "yop",
215
 
    .flags = AVFMT_GENERIC_INDEX,
 
218
    .extensions     = "yop",
 
219
    .flags          = AVFMT_GENERIC_INDEX,
216
220
};