summaryrefslogtreecommitdiff
path: root/libavformat/segafilmenc.c
Commit message (Collapse)AuthorAge
* avformat/mux_utils: Move ff_format_shift_data to new file for mux utilsAndreas Rheinhardt2022-05-10
| | | | | | | | It is only used by muxers. Given that it is not part of the core muxing code and given that mux.c is already big enough, it is moved to a new file for utility functions for muxing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* segafilm: convert to new channel layout APIVittorio Giovara2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/segafilmenc: use ff_format_shift_data for shiftingMarton Balint2022-01-03
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/segafilmenc: Avoid seek when writing headerAndreas Rheinhardt2020-07-26
| | | | | | | | | | | | | | | | | | Up until now, the Sega FILM muxer would first write all the packet data, then shift the data (in the muxer's write_trailer function) by the amount necessary to write the header at the front (which entails a seek to the front), then seek back to the beginning and actually write the header. This commit changes this: The dynamic buffer that is used to write the sample table (containing information about each sample in the file) is now used to write the complete header. This is possible because the size of everything in the header except the sample table is known in advance. Said buffer can then be used as one of the two temporary buffers used for shifting which also reduces the amount one has to allocate for this. Thereby the header will be written when shifting, so that the second seek to the beginning is unnecessary. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segafilmenc: Don't store packet info in linked listAndreas Rheinhardt2020-07-26
| | | | | | | | | | | | | | | | | Up until now, the Sega FILM muxer would store some information about each packet in a linked list. When writing the trailer, the information in said linked list would be used to write a table in the file header. Each entry in said table is 16 bytes long, but each entry of the linked list is 32 bytes long (assuming 64 bit pointer and no padding). Therefore it makes sense to remove the linked list and write the array entries directly into a dynamic buffer while writing the packet (this is possible because the table entries don't depend on any information not available when writing the packet (the offset is not relative to the beginning of the file, but to the end of the table). This also simplifies writing the array at the end (there is no need to traverse a linked list). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segafilmenc: Simplify writing two bytesAndreas Rheinhardt2020-07-26
| | | | | | Use avio_wb16() instead of avio_write() to write two zero bytes. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segafilmenc: Remove write-only variableAndreas Rheinhardt2020-07-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segafilmenc: Add deinit functionAndreas Rheinhardt2020-02-25
| | | | | | | | Prevents memleaks when the trailer is never written or when shifting the data fails when writing the trailer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/segafilmenc: Combine several checksAndreas Rheinhardt2020-02-25
| | | | | | | by moving them around. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/segafilmenc: Remove redundant checksAndreas Rheinhardt2020-02-22
| | | | | | | | | | | | | | | | | | If an audio stream is present, the Sega FILM muxer checks for its compability with the container during init, so that the very same check needn't be repeated during writing the trailer. Essentially the same is true for the presence of a video stream: It has already been checked during init. Furthermore, after the check for the presence of a video stream succeeded, a pointer is set to point to the video stream. Yet said pointer (which was NULL before) will be derefenced anyway regardless of the result of the check. Coverity thus complained about this in CID 1434155 and removing this pointless check will also fix this issue. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/segafilmenc: Remove AVClassAndreas Rheinhardt2020-02-15
| | | | | | | | | This muxer does not have any private options and so does not need a private class. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/movenc, segafilmenc: Remove unnecessary avio_tell()Andreas Rheinhardt2020-01-17
| | | | | | | | | | | | | | When the faststart option for the mov/mp4 muxer is used, the current position (i.e. the size of the already written data pre-shifting) was evaluated twice: First in an initialization and then again later, overwriting the first value without having ever touched it. So remove the initialization. Also, the clone of this code in the Sega FILM muxer behaves the same and has been treated the same. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/segafilmenc: Check early whether video is allowedAndreas Rheinhardt2020-01-14
| | | | | | | | | | The current code only checks when writing the trailer whether the video format and Codec ID are actually compatible with the container. At this point, a lot of data will already have been written (in vain, of course), so check during the init function instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/segafilmenc: Postpone check for existence of video streamAndreas Rheinhardt2020-01-14
| | | | | | | | | Up until now, the Sega FILM muxer complained if the first stream wasn't a video stream that there is no video stream at all which is of course nonsense. So postpone this check. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/segafilmenc: Fix undefined left shift of 1 by 31 placesAndreas Rheinhardt2020-01-14
| | | | | | | by changing the type to unsigned. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: remove more unneeded avio_flush() callsMarton Balint2020-01-07
| | | | | | | | | | | | These instances are simply redundant or present because avio_flush() used to be required before doing a seekback. That is no longer the case, aviobuf code does the flush automatically on seek. This only affects code which is either disabled for streaming IO contexts or does no seekbacks after the flush, so this change should have no adverse effect on streaming. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/segafilmenc: remove unneeded codeSteven Liu2019-10-22
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/segafilmenc - set keyframe bit correctlyGyan Doshi2018-05-08
| | | | | | | | As per https://web.archive.org/web/20020803104640/http://www.pcisys.net:80/~melanson/codecs/film-format.txt, the top bit of the info1 chunk is set as 1 for inter-coded frames and 0 otherwise.
* lavf/segafilmenc: Do not mix variable declaration and code.Carl Eugen Hoyos2018-04-10
| | | | Fixes two warnings: ISO C90 forbids mixed declarations and code
* Add Sega FILM muxerMisty De Meo2018-04-05
Signed-off-by: Josh de Kock <josh@itanimul.li>