1 /*
2 * SCC muxer
3 * Copyright (c) 2017 Paul B Mahol
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
26
32
34 {
36
40 "SCC supports only a single subtitles stream.\n");
42 }
45 "Unsupported subtitles codec: %s\n",
48 }
51
54
55 return 0;
56 }
57
59 {
63
66 "Insufficient timestamps.\n");
67 return 0;
68 }
69
70 h = (
int)(pts / (3600000));
71 m = (
int)(pts / (60000)) % 60;
72 s = (
int)(pts / 1000) % 60;
73 f = (
int)(pts % 1000) / 33;
74
75 for (i = 0; i < pkt->
size; i+=3) {
76 if (pkt->
data[i] == 0xfc && ((pkt->
data[i + 1] != 0x80 || pkt->
data[i + 2] != 0x80)))
77 break;
78 }
80 return 0;
81
85 }
86 for (i = 0; i < pkt->
size; i+=3) {
87 if (i + 3 > pkt->
size)
88 break;
89
90 if (pkt->
data[i] != 0xfc || (pkt->
data[i + 1] == 0x80 && pkt->
data[i + 2] == 0x80))
91 continue;
95 }
100 }
105 }
106
111 return 0;
112 }
113
117 .extensions = "scc",
123 };
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
#define AV_LOG_WARNING
Something somehow does not look correct.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
static int scc_write_header(AVFormatContext *avf)
AVStream ** streams
A list of all streams in the file.
AVOutputFormat ff_scc_muxer
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVMediaType codec_type
General type of the encoded data.
static int scc_write_packet(AVFormatContext *avf, AVPacket *pkt)
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
AVIOContext * pb
I/O context.
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2