#include "voc.h"
#include "libavutil/intreadwrite.h"
-typedef struct {
+typedef struct C93BlockRecord {
uint16_t index;
uint8_t length;
uint8_t frames;
} C93BlockRecord;
-typedef struct {
+typedef struct C93DemuxContext {
VocDecContext voc;
C93BlockRecord block_records[512];
return AVPROBE_SCORE_MAX;
}
-static int read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
AVStream *video;
AVIOContext *pb = s->pb;
if (!video)
return AVERROR(ENOMEM);
- video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- video->codec->codec_id = CODEC_ID_C93;
- video->codec->width = 320;
- video->codec->height = 192;
+ video->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ video->codecpar->codec_id = AV_CODEC_ID_C93;
+ video->codecpar->width = 320;
+ video->codecpar->height = 192;
/* 4:3 320x200 with 8 empty lines */
video->sample_aspect_ratio = (AVRational) { 5, 6 };
avpriv_set_pts_info(video, 64, 2, 25);
c93->audio = avformat_new_stream(s, NULL);
if (!c93->audio)
return AVERROR(ENOMEM);
- c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ c93->audio->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
}
avio_skip(pb, 26); /* VOC header */
- ret = voc_get_packet(s, pkt, c93->audio, datasize - 26);
+ ret = ff_voc_get_packet(s, pkt, c93->audio, datasize - 26);
if (ret > 0) {
pkt->stream_index = 1;
pkt->flags |= AV_PKT_FLAG_KEY;
return 0;
fail:
- av_free_packet(pkt);
+ av_packet_unref(pkt);
return ret;
}