X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmxg.c;h=245afb40ef19f1c68741995cacea6a133d1b42b2;hb=d60c2d5216930ef98c7d4d6837d6229b37e0dcb3;hp=3f8c3e339e49b8f3aac753d194e878568bcedee7;hpb=6e9651d1064b6a3e18c24f15d5b03bb9c5fc3393;p=ffmpeg diff --git a/libavformat/mxg.c b/libavformat/mxg.c index 3f8c3e339e4..245afb40ef1 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/channel_layout.h" +#include "libavutil/internal.h" #include "libavutil/intreadwrite.h" #include "libavcodec/mjpeg.h" #include "avformat.h" @@ -46,19 +48,20 @@ static int mxg_read_header(AVFormatContext *s) video_st = avformat_new_stream(s, NULL); if (!video_st) return AVERROR(ENOMEM); - video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - video_st->codec->codec_id = CODEC_ID_MXPEG; + video_st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; + video_st->codecpar->codec_id = AV_CODEC_ID_MXPEG; avpriv_set_pts_info(video_st, 64, 1, 1000000); audio_st = avformat_new_stream(s, NULL); if (!audio_st) return AVERROR(ENOMEM); - audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - audio_st->codec->codec_id = CODEC_ID_PCM_ALAW; - audio_st->codec->channels = 1; - audio_st->codec->sample_rate = 8000; - audio_st->codec->bits_per_coded_sample = 8; - audio_st->codec->block_align = 1; + audio_st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; + audio_st->codecpar->codec_id = AV_CODEC_ID_PCM_ALAW; + audio_st->codecpar->channels = 1; + audio_st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; + audio_st->codecpar->sample_rate = 8000; + audio_st->codecpar->bits_per_coded_sample = 8; + audio_st->codecpar->block_align = 1; avpriv_set_pts_info(audio_st, 64, 1, 1000000); mxg->soi_ptr = mxg->buffer_ptr = mxg->buffer = 0; @@ -107,7 +110,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) if (mxg->soi_ptr) soi_pos = mxg->soi_ptr - mxg->buffer; mxg->buffer = av_fast_realloc(mxg->buffer, &mxg->buffer_size, current_pos + cache_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!mxg->buffer) return AVERROR(ENOMEM); mxg->buffer_ptr = mxg->buffer + current_pos; @@ -166,7 +169,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pts = pkt->dts = mxg->dts; pkt->stream_index = 0; - pkt->destruct = NULL; + pkt->buf = NULL; pkt->size = mxg->buffer_ptr - mxg->soi_ptr; pkt->data = mxg->soi_ptr; @@ -204,7 +207,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) /* time (GMT) of first sample in usec since 1970, little-endian */ pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8); pkt->stream_index = 1; - pkt->destruct = NULL; + pkt->buf = NULL; pkt->size = size - 14; pkt->data = startmarker_ptr + 16; @@ -240,11 +243,11 @@ static int mxg_close(struct AVFormatContext *s) } AVInputFormat ff_mxg_demuxer = { - .name = "mxg", - .long_name = NULL_IF_CONFIG_SMALL("MxPEG clip file format"), + .name = "mxg", + .long_name = NULL_IF_CONFIG_SMALL("MxPEG clip"), .priv_data_size = sizeof(MXGContext), - .read_header = mxg_read_header, - .read_packet = mxg_read_packet, - .read_close = mxg_close, - .extensions = "mxg" + .read_header = mxg_read_header, + .read_packet = mxg_read_packet, + .read_close = mxg_close, + .extensions = "mxg", };