History

lavf/avs3dec: add raw avs3 demuxer

hwren committed 6 years ago

Commit ff74ad21 parent 6223d775 files · +72 −1Browse files

Unified · Split

5 files
  1. Changelog +1 −0
  2. libavformat/Makefile +1 −0
  3. libavformat/allformats.c +1 −0
  4. libavformat/avs3dec.c +68 −0
  5. libavformat/version.h +1 −1
Changelog+1−0
@@ -32,6 +32,7 @@ version <next>: · 31 unmodified lines
32- Argonaut Games Video decoder32- Argonaut Games Video decoder
33- libwavpack encoder removed33- libwavpack encoder removed
34- ACE demuxer34- ACE demuxer
35- AVS3 demuxer
35 36
36 37
37version 4.3:38version 4.3:
libavformat/Makefile+1−0
@@ -125,6 +125,7 @@ OBJS-$(CONFIG_AVR_DEMUXER) += avr.o pcm.o · 124 unmodified lines
125OBJS-$(CONFIG_AVS_DEMUXER) += avs.o voc_packet.o vocdec.o voc.o125OBJS-$(CONFIG_AVS_DEMUXER) += avs.o voc_packet.o vocdec.o voc.o
126OBJS-$(CONFIG_AVS2_DEMUXER) += davs2.o rawdec.o126OBJS-$(CONFIG_AVS2_DEMUXER) += davs2.o rawdec.o
127OBJS-$(CONFIG_AVS2_MUXER) += rawenc.o127OBJS-$(CONFIG_AVS2_MUXER) += rawenc.o
128OBJS-$(CONFIG_AVS3_DEMUXER) += avs3dec.o rawdec.o
128OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o129OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o
129OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o130OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o
130OBJS-$(CONFIG_BINK_DEMUXER) += bink.o131OBJS-$(CONFIG_BINK_DEMUXER) += bink.o
libavformat/allformats.c+1−0
@@ -87,6 +87,7 @@ extern AVInputFormat ff_avr_demuxer; · 86 unmodified lines
87extern AVInputFormat ff_avs_demuxer;87extern AVInputFormat ff_avs_demuxer;
88extern AVInputFormat ff_avs2_demuxer;88extern AVInputFormat ff_avs2_demuxer;
89extern AVOutputFormat ff_avs2_muxer;89extern AVOutputFormat ff_avs2_muxer;
90extern AVInputFormat ff_avs3_demuxer;
90extern AVInputFormat ff_bethsoftvid_demuxer;91extern AVInputFormat ff_bethsoftvid_demuxer;
91extern AVInputFormat ff_bfi_demuxer;92extern AVInputFormat ff_bfi_demuxer;
92extern AVInputFormat ff_bintext_demuxer;93extern AVInputFormat ff_bintext_demuxer;
libavformat/avs3dec.c+68−0
@@ -0,0 +1,68 @@
1/*
2 * RAW AVS3-P2/IEEE1857.10 video demuxer
3 * Copyright (c) 2020 Zhenyu Wang <wangzhenyu@pkusz.edu.cn>
4 * Bingjie Han <hanbj@pkusz.edu.cn>
5 * Huiwen Ren <hwrenx@gmail.com>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include "libavcodec/avs3.h"
25#include "libavcodec/internal.h"
26#include "avformat.h"
27#include "rawdec.h"
28
29static int avs3video_probe(const AVProbeData *p)
30{
31 const uint8_t *ptr = p->buf, *end = p->buf + p->buf_size;
32 uint32_t code = -1;
33 uint8_t state = 0;
34 int pic = 0, seq = 0, slice_pos = 0;
35 int ret = 0;
36
37 while (ptr < end) {
38 ptr = avpriv_find_start_code(ptr, end, &code);
39 state = code & 0xFF;
40 if ((code & 0xFFFFFF00) == 0x100) {
41 if (state < AVS3_SEQ_START_CODE) {
42 if (code < slice_pos)
43 return 0;
44 slice_pos = code;
45 } else {
46 slice_pos = 0;
47 }
48 if (state == AVS3_SEQ_START_CODE) {
49 seq++;
50 if (*ptr != AVS3_PROFILE_BASELINE_MAIN && *ptr != AVS3_PROFILE_BASELINE_MAIN10)
51 return 0;
52 } else if (AVS3_ISPIC(state)) {
53 pic++;
54 } else if ((state == AVS3_UNDEF_START_CODE) ||
55 (state > AVS3_VIDEO_EDIT_CODE)) {
56 return 0;
57 }
58 }
59 }
60
61 if (seq && pic && av_match_ext(p->filename, "avs3")) {
62 ret = AVPROBE_SCORE_MAX;
63 }
64
65 return ret;
66}
67
68FF_DEF_RAWVIDEO_DEMUXER(avs3, "raw AVS3-P2/IEEE1857.10", avs3video_probe, "avs3", AV_CODEC_ID_AVS3)
libavformat/version.h+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
32// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)32// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
33// Also please add any ticket numbers that you believe might be affected here33// Also please add any ticket numbers that you believe might be affected here
34#define LIBAVFORMAT_VERSION_MAJOR 5834#define LIBAVFORMAT_VERSION_MAJOR 58
35#define LIBAVFORMAT_VERSION_MINOR 6035#define LIBAVFORMAT_VERSION_MINOR 61
36#define LIBAVFORMAT_VERSION_MICRO 10036#define LIBAVFORMAT_VERSION_MICRO 100
37 37
38#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \38#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t