FFmpeg: libavformat/wsddec.c Source File
Go to the documentation of this file. 1 /*
2 * Wideband Single-bit Data (WSD) demuxer
3 * Copyright (c) 2014 Peter Ross
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
29
31 {
32 if (
p->buf_size < 45 || memcmp(
p->buf,
"1bit", 4) ||
34 (
p->buf[0] >= 0x10 && (
AV_RB32(
p->buf + 20) < 0x80 ||
AV_RB32(
p->buf + 24) < 0x80)))
35 return 0;
37 }
38
40 {
42 if (*buf++ != ' ')
43 return 0;
44 }
45 return 1;
46 }
47
49 {
52 case 3:
54 break;
56 case 5:
58 break;
66 default:
68 break;
69 }
70 return 0;
71 }
72
74 {
75 uint8_t *buf;
78
80 if (!buf)
82
86 }
87
90 return 0;
91 }
92
95 return 0;
96 }
97
99 {
103 uint32_t text_offset, data_offset, channel_assign;
105
107 if (!st)
109
114
116 text_offset = 0x80;
117 data_offset = 0x800;
119 } else {
122 }
123
126 av_dict_set(&
s->metadata,
"playback_time", playback_time, 0);
127
137
140 if (!(channel_assign & 1)) {
141 uint64_t ch_mask = 0;
143 for (
i = 1;
i < 32;
i++)
144 if ((channel_assign >>
i) & 1)
147 }
148
152
153 if (
avio_seek(pb, text_offset, SEEK_SET) >= 0) {
164 }
165
166 return avio_seek(pb, data_offset, SEEK_SET);
167 }
168
172 .p.extensions = "wsd",
180 };
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_TIMECODE_STR_SIZE
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVMediaType codec_type
General type of the encoded data.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
static int wsd_to_av_channel_layoyt(AVFormatContext *s, int bit)
static int get_metadata(AVFormatContext *s, const char *const tag, const unsigned size)
int nb_channels
Number of channels in this layout.
#define bit(string, value)
static int empty_string(const char *buf, unsigned size)
const FFInputFormat ff_wsd_demuxer
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
unsigned int avio_rb32(AVIOContext *s)
#define AV_CH_LOW_FREQUENCY
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
#define AV_CH_FRONT_CENTER
AVChannelLayout ch_layout
Audio only.
#define AV_CH_FRONT_LEFT_OF_CENTER
int sample_rate
Audio only.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int wsd_probe(const AVProbeData *p)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
int avio_r8(AVIOContext *s)
#define AV_CH_FRONT_RIGHT_OF_CENTER
static int wsd_read_header(AVFormatContext *s)
#define i(width, name, range_min, range_max)
char * av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field)
Get the timecode string from the SMPTE timecode format.
#define AV_CH_BACK_CENTER
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
#define AV_CH_FRONT_RIGHT
#define avpriv_request_sample(...)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Generated on Sat Oct 18 2025 19:23:32 for FFmpeg by
doxygen
1.8.17